Re: Issues with Information_schema.views
jian he <jian.universality@gmail.com>
From: jian he <jian.universality@gmail.com>
To: Erki Eessaar <erki.eessaar@taltech.ee>
Cc: "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2023-10-29T11:53:29Z
Lists: 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.