Re: BUG #18178: New Restriction on "ON SELECT" rules on tables
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: joshua.uyehara@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Date: 2023-11-02T14:20:02Z
Lists: pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes: > The documentation for rules specifically states that "ON SELECT" rules can > be created on tables (and I have functionality/use cases that rely on that) > behavior, but pg16 breaks that. If the documentation still says that, it needs to be updated. What are you looking at precisely? > The issue is, basically, that there are broad classes of database > abstraction middleware that are configured via database introspection at > runtime and do not understand or implement the concept of updateable views > and foreign tables. The easiest workaround for that limitation in postgres > has always been to create a local table stand-in with all operations > rerouted to the foreign table via rules. TBH, I don't believe that argument for a second. Pre-v16, what happened when you added an ON SELECT rule to a table is that *the table got changed into a view* (which is what caused the bugs mentioned in the thread Daniel pointed you to). There is no difference between the subsequent catalog state and what you would have if you'd just created it as a view in the first place. So do that and then add whatever non-SELECT rules you need, and you should be in the same place as before (and your code will still work with pre-v16 releases, too). regards, tom lane
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