From: | Ian Lawrence Barwick <barwick(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: "CREATE RULE ... ON SELECT": redundant? |
Date: | 2023-05-04 04:12:49 |
Message-ID: | CAB8KJ=hDN2u=QRFX9oiEdVwjgjnnPsiqu03gUrxFAqi7-zDwGg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2023年5月4日(木) 12:51 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>
> Ian Lawrence Barwick <barwick(at)gmail(dot)com> writes:
> > While poking around at an update for that, unless I'm missing something it is
> > now not possible to use "CREATE RULE ... ON SELECT" for any kind of relation,
> > given that it's disallowed on views / material views already.
>
> What makes you think it's disallowed on views? You do need to use
> CREATE OR REPLACE, since the rule will already exist.
Ah, "OR REPLACE". Knew I was missing something.
> regression=# create view v as select * from int8_tbl ;
> CREATE VIEW
> regression=# create or replace rule "_RETURN" as on select to v do instead select q1, q2+1 as q2 from int8_tbl ;
> CREATE RULE
> regression=# \d+ v
> View "public.v"
> Column | Type | Collation | Nullable | Default | Storage | Description
> --------+--------+-----------+----------+---------+---------+-------------
> q1 | bigint | | | | plain |
> q2 | bigint | | | | plain |
> View definition:
> SELECT int8_tbl.q1,
> int8_tbl.q2 + 1 AS q2
> FROM int8_tbl;
>
> Now, this is certainly syntax that's deprecated in favor of using
> CREATE OR REPLACE VIEW, but I'm very hesitant to remove it. ISTR
> that ancient pg_dump files used it in cases involving circular
> dependencies. If you want to adjust the docs to say that it's
> deprecated in favor of CREATE OR REPLACE VIEW, I could get on
> board with that.
'k, I will work on a doc patch.
Thanks
Ian Barwick
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2023-05-04 04:43:17 | Re: Add two missing tests in 035_standby_logical_decoding.pl |
Previous Message | Hayato Kuroda (Fujitsu) | 2023-05-04 04:03:55 | RE: [PoC] pg_upgrade: allow to upgrade publisher node |