Re: BUG #18178: New Restriction on "ON SELECT" rules on tables
Laurenz Albe <laurenz.albe@cybertec.at>
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Joshua Uyehara <joshua.uyehara@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@lists.postgresql.org
Date: 2023-11-03T15:21:10Z
Lists: pgsql-bugs
Attachments
- 0001-Forbid-explicitly-creating-ON-SELECT-rules.patch (text/x-patch) patch 0001
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
Commits
-
Doc: update CREATE RULE ref page's hoary discussion of views.
- f53f83b33e42 14.10 landed
- 9d4ea0bb3fd4 16.1 landed
- 95a610b0970d 17.0 landed
- 58d3283b6756 15.5 landed
- 3f9fe9b76f90 11.22 landed
- 1f7d7f102d14 12.17 landed
- 111364ec20e1 13.13 landed
-
Remove logic for converting a table to a view.
- b23cd185fd54 16.0 cited