Re: BUG #17646: create rule named "_RETURN" will cause pg core

From: Ilya Anfimov <ilan(at)tzirechnoy(dot)com>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17646: create rule named "_RETURN" will cause pg core
Date: 2022-10-17 14:33:38
Message-ID: 20221017143338.GA3864491@azor.tzirechnoy.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Oct 17, 2022 at 10:17:55AM -0400, Tom Lane wrote:
> PG Bug reporting form <noreply(at)postgresql(dot)org> 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
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Ilya Anfimov 2022-10-17 14:38:38 Re: BUG #17646: create rule named "_RETURN" will cause pg core
Previous Message PG Bug reporting form 2022-10-17 14:18:44 BUG #17647: 12.12 package has difference on ubuntu 18.04