Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1okRBc-0000Tg-4N for pgsql-bugs@arkaria.postgresql.org; Mon, 17 Oct 2022 14:33:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1okRBa-0001L3-7V for pgsql-bugs@arkaria.postgresql.org; Mon, 17 Oct 2022 14:33:46 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1okRBZ-0001Kt-VB for pgsql-bugs@lists.postgresql.org; Mon, 17 Oct 2022 14:33:45 +0000 Received: from carbon.misis.ru ([85.143.104.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1okRBX-0000nH-7Z for pgsql-bugs@lists.postgresql.org; Mon, 17 Oct 2022 14:33:44 +0000 Received: from mail.tzirechnoy.ru (unknown [10.1.250.11]) by carbon.misis.ru (Postfix) with ESMTP id 53C2720299 for ; Mon, 17 Oct 2022 17:33:39 +0300 (MSK) Received: by mail.tzirechnoy.ru (Postfix, from userid 1000) id 1011BA42B1; Mon, 17 Oct 2022 17:33:38 +0300 (MSK) Date: Mon, 17 Oct 2022 17:33:38 +0300 From: Ilya Anfimov To: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17646: create rule named "_RETURN" will cause pg core Message-ID: <20221017143338.GA3864491@azor.tzirechnoy.ru> Mail-Followup-To: Ilya Anfimov , pgsql-bugs@lists.postgresql.org References: <17646-70c93cfa40365776@postgresql.org> <2164336.1666016275@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2164336.1666016275@sss.pgh.pa.us> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spamd-Result: default: False [-0.00 / 15.00]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; BAYES_HAM(-0.00)[32.09%] X-Rspamd-Queue-Id: 53C2720299 X-Rspamd-Server: carbon List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Oct 17, 2022 at 10:17:55AM -0400, Tom Lane wrote: > PG Bug reporting form writes: > > here is a test case > > > create table t (id integer); > > create view v1 as select * from t; > > create or replace rule "_RETURN" as on UPDATE to v1 do instead select * from > > t; > > Meh. We should be preventing you from doing that. > > (Although the core dump is also not great --- something should've noticed > the bogosity of the plan earlier than this.) Id doesn't look much of a plan bogosity, but rather implicit deletion of the "_RETURN" on select rule. Consider the behaviour of the direct drop rule: ilan=*> create table t (id integer); CREATE TABLE ilan=*> create view v1 as select * from t; CREATE VIEW ilan=*> DROP RULE "_RETURN" ON v1; ERROR: cannot drop rule _RETURN on view v1 because view v1 requires it рпдулбълб: You can drop view v1 instead. > > regards, tom lane >