diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2021-08-19 12:12:35 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2021-08-19 12:12:35 -0400 |
commit | 8d2d6ec7708b475787fd92a9f828e554805e3df6 (patch) | |
tree | b8dd5475b30e83538485d6686232471adfa2a609 /src/include/nodes/parsenodes.h | |
parent | bed5eac2d50eb86a254861dcdea7b064d10c72cf (diff) | |
download | postgresql-8d2d6ec7708b475787fd92a9f828e554805e3df6.tar.gz postgresql-8d2d6ec7708b475787fd92a9f828e554805e3df6.zip |
Avoid trying to lock OLD/NEW in a rule with FOR UPDATE.
transformLockingClause neglected to exclude the pseudo-RTEs for
OLD/NEW when processing a rule's query. This led to odd errors
or even crashes later on. This bug is very ancient, but it's
not terribly surprising that nobody noticed, since the use-case
for SELECT FOR UPDATE in a non-view rule is somewhere between
thin and non-existent. Still, crashing is not OK.
Per bug #17151 from Zhiyong Wu. Thanks to Masahiko Sawada
for analysis of the problem.
Discussion: https://postgr.es/m/17151-c03a3e6e4ec9aadb@postgresql.org
Diffstat (limited to 'src/include/nodes/parsenodes.h')
-rw-r--r-- | src/include/nodes/parsenodes.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index e28248af324..7af13dee43b 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -929,10 +929,10 @@ typedef struct PartitionCmd * inFromCl marks those range variables that are listed in the FROM clause. * It's false for RTEs that are added to a query behind the scenes, such * as the NEW and OLD variables for a rule, or the subqueries of a UNION. - * This flag is not used anymore during parsing, since the parser now uses - * a separate "namespace" data structure to control visibility, but it is - * needed by ruleutils.c to determine whether RTEs should be shown in - * decompiled queries. + * This flag is not used during parsing (except in transformLockingClause, + * q.v.); the parser now uses a separate "namespace" data structure to + * control visibility. But it is needed by ruleutils.c to determine + * whether RTEs should be shown in decompiled queries. * * requiredPerms and checkAsUser specify run-time access permissions * checks to be performed at query startup. The user must have *all* |