Re: BUG #18178: New Restriction on "ON SELECT" rules on tables

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Joshua Uyehara <joshua(dot)uyehara(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18178: New Restriction on "ON SELECT" rules on tables
Date: 2023-11-03 15:21:10
Message-ID: 8a0dd07e617563892e727a8119f9a34f86524eb1.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, 2023-11-03 at 00:44 -1000, Joshua Uyehara wrote:
> As far as the documentation error, on closer review, Part V, 41.2 ("Views and the Rules system")
> was updated to reflect the change, but the Reference entry for Create Rule in Part VI was not:
>
> > Presently, ON SELECT rules must be unconditional INSTEAD rules and must have actions that
> > consist of a single SELECT command. Thus, an ON SELECT rule effectively turns the table into
> > a view, whose visible contents are the rows returned by the rule's SELECT command rather than
> > whatever had been stored in the table (if anything). It is considered better style to write a
> > CREATE VIEW command than to create a real table and define an ON SELECT rule for it.

Yes, that paragraph has to go.

But I wonder if it would not be better to completely remove ON SELECT from the CREATE RULE
command. Attached is a patch that does that.

The documentation part of this patch should be backpatched to v16, but the rest is
HEAD only.

Yours,
Laurenz Albe

Attachment Content-Type Size
0001-Forbid-explicitly-creating-ON-SELECT-rules.patch text/x-patch 9.0 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2023-11-03 15:50:58 Re: BUG #18178: New Restriction on "ON SELECT" rules on tables
Previous Message Robert Leach 2023-11-03 14:45:34 Re: BUG #18177: certain queries under certain contexts take multiple orders of magnitude longer compared to v10