Re: Issues with Information_schema.views

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Erki Eessaar <erki(dot)eessaar(at)taltech(dot)ee>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Issues with Information_schema.views
Date: 2023-10-29 11:53:29
Message-ID: CACJufxHCp1phr1HSzaEnj_4HqK+Rw_PaK8a+-s3hi4vh3SSvmw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Oct 29, 2023 at 4:05 PM Erki Eessaar <erki(dot)eessaar(at)taltech(dot)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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2023-10-29 14:22:27 Re: run pgindent on a regular basis / scripted manner
Previous Message David Rowley 2023-10-29 10:30:44 Re: Use virtual tuple slot for Unique node