Re: Issues with Information_schema.views - Mailing list pgsql-hackers

From jian he
Subject Re: Issues with Information_schema.views
Date
Msg-id CACJufxHCp1phr1HSzaEnj_4HqK+Rw_PaK8a+-s3hi4vh3SSvmw@mail.gmail.com
Whole thread Raw
In response to Re: Issues with Information_schema.views  (Erki Eessaar <erki.eessaar@taltech.ee>)
List pgsql-hackers
On Sun, Oct 29, 2023 at 4:05 PM Erki Eessaar <erki.eessaar@taltech.ee> wrote:
>
> Hello
>
> Thank you! I know that.
>
>
> Secondly, the rule you demonstrated does not alone change IS_UPDATABLE value to YES. I have to create two rules:
>
>  CREATE OR REPLACE RULE emps_update AS ON UPDATE
>     TO Emps
>     DO INSTEAD UPDATE emp SET
>         empno = NEW.empno,
>         ename = NEW.ename,
>         deptno = NEW.deptno;
>
>  CREATE OR REPLACE RULE emps_delete AS ON DELETE
>     TO Emps
>     DO INSTEAD DELETE FROM Emp WHERE empno=OLD.empno;
>
> My question is - is all of this the intended behaviour by the implementers?
>
> Best regards
> Erki Eessaar
>

per test, it's the expected behavior.
https://git.postgresql.org/cgit/postgresql.git/tree/src/test/regress/expected/updatable_views.out#n569
https://git.postgresql.org/cgit/postgresql.git/tree/src/test/regress/expected/updatable_views.out#n603
https://git.postgresql.org/cgit/postgresql.git/tree/src/test/regress/expected/updatable_views.out#n637

you need CREATE RULE  AS ON DELETE and CREATE RULE AS ON UPDATE to
mark the view as is_updatable.



pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Use virtual tuple slot for Unique node
Next
From: Andrew Dunstan
Date:
Subject: Re: run pgindent on a regular basis / scripted manner