Re: BUG #18178: New Restriction on "ON SELECT" rules on tables - Mailing list pgsql-bugs

From Laurenz Albe
Subject Re: BUG #18178: New Restriction on "ON SELECT" rules on tables
Date
Msg-id 8a0dd07e617563892e727a8119f9a34f86524eb1.camel@cybertec.at
Whole thread Raw
In response to Re: BUG #18178: New Restriction on "ON SELECT" rules on tables  (Joshua Uyehara <joshua.uyehara@gmail.com>)
Responses Re: BUG #18178: New Restriction on "ON SELECT" rules on tables
List 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

pgsql-bugs by date:

Previous
From: Robert Leach
Date:
Subject: Re: BUG #18177: certain queries under certain contexts take multiple orders of magnitude longer compared to v10
Next
From: Tom Lane
Date:
Subject: Re: BUG #18178: New Restriction on "ON SELECT" rules on tables