postgresql/src/backend
Tom Lane 47bb9db759 Get rid of the "new" and "old" entries in a view's rangetable.
The rule system needs "old" and/or "new" pseudo-RTEs in rule actions
that are ON INSERT/UPDATE/DELETE.  Historically it's put such entries
into the ON SELECT rules of views as well, but those are really quite
vestigial.  The only thing we've used them for is to carry the
view's relid forward to AcquireExecutorLocks (so that we can
re-lock the view to verify it hasn't changed before re-using a plan)
and to carry its relid and permissions data forward to execution-time
permissions checks.  What we can do instead of that is to retain
these fields of the RTE_RELATION RTE for the view even after we
convert it to an RTE_SUBQUERY RTE.  This requires a tiny amount of
extra complication in the planner and AcquireExecutorLocks, but on
the other hand we can get rid of the logic that moves that data from
one place to another.

The principal immediate benefit of doing this, aside from a small
saving in the pg_rewrite data for views, is that these pseudo-RTEs
no longer trigger ruleutils.c's heuristic about qualifying variable
names when the rangetable's length is more than 1.  That results
in quite a number of small simplifications in regression test outputs,
which are all to the good IMO.

Bump catversion because we need to dump a few more fields of
RTE_SUBQUERY RTEs.  While those will always be zeroes anyway in
stored rules (because we'd never populate them until query rewrite)
they are useful for debugging, and it seems like we'd better make
sure to transmit such RTEs accurately in plans sent to parallel
workers.  I don't think the executor actually examines these fields
after startup, but someday it might.

This is a second attempt at committing 1b4d280ea.  The difference
from the first time is that now we can add some filtering rules to
AdjustUpgrade.pm to allow cross-version upgrade testing to pass
despite all the cosmetic changes in CREATE VIEW outputs.

Amit Langote (filtering rules by me)

Discussion: https://postgr.es/m/CA+HiwqEf7gPN4Hn+LoZ4tP2q_Qt7n3vw7-6fJKOf92tSEnX6Gg@mail.gmail.com
Discussion: https://postgr.es/m/891521.1673657296@sss.pgh.pa.us
2023-01-18 13:23:57 -05:00
..
access Refactor code for restoring files via shell commands 2023-01-18 11:15:48 +09:00
backup Add BufFileRead variants with short read and EOF detection 2023-01-16 11:01:31 +01:00
bootstrap Update copyright for 2023 2023-01-02 15:00:37 -05:00
catalog Display the leader apply worker's PID for parallel apply workers. 2023-01-18 09:03:12 +05:30
commands Get rid of the "new" and "old" entries in a view's rangetable. 2023-01-18 13:23:57 -05:00
executor Remove redundant grouping and DISTINCT columns. 2023-01-18 12:37:57 -05:00
foreign Update copyright for 2023 2023-01-02 15:00:37 -05:00
jit Fix typos in comments, code and documentation 2023-01-03 16:26:14 +09:00
lib Constify the arguments of ilist.c/h functions 2023-01-12 08:00:51 +01:00
libpq Store IdentLine->pg_user as an AuthToken 2023-01-16 13:58:07 +09:00
main Update copyright for 2023 2023-01-02 15:00:37 -05:00
nodes Get rid of the "new" and "old" entries in a view's rangetable. 2023-01-18 13:23:57 -05:00
optimizer Get rid of the "new" and "old" entries in a view's rangetable. 2023-01-18 13:23:57 -05:00
parser Get rid of the "new" and "old" entries in a view's rangetable. 2023-01-18 13:23:57 -05:00
partitioning Update copyright for 2023 2023-01-02 15:00:37 -05:00
po Update copyright for 2023 2023-01-02 15:00:37 -05:00
port Update copyright for 2023 2023-01-02 15:00:37 -05:00
postmaster Refactor DetermineSleepTime() to use milliseconds. 2023-01-12 16:32:30 +13:00
regex Update copyright for 2023 2023-01-02 15:00:37 -05:00
replication Display the leader apply worker's PID for parallel apply workers. 2023-01-18 09:03:12 +05:30
rewrite Get rid of the "new" and "old" entries in a view's rangetable. 2023-01-18 13:23:57 -05:00
snowball Update copyright for 2023 2023-01-02 15:00:37 -05:00
statistics Update copyright for 2023 2023-01-02 15:00:37 -05:00
storage Constify the arguments of copydir.h functions 2023-01-18 08:55:26 +09:00
tcop Use WaitEventSet API for postmaster's event loop. 2023-01-12 16:32:20 +13:00
tsearch New header varatt.h split off from postgres.h 2023-01-10 05:54:36 +01:00
utils Get rid of the "new" and "old" entries in a view's rangetable. 2023-01-18 13:23:57 -05:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Blind attempt to fix LLVM dependency in the backend 2022-09-15 10:53:48 +07:00
Makefile Update copyright for 2023 2023-01-02 15:00:37 -05:00
meson.build Update copyright for 2023 2023-01-02 15:00:37 -05:00
nls.mk NLS: Put list of available languages into LINGUAS files 2022-07-13 08:19:17 +02:00