summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2021-08-19 12:12:35 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2021-08-19 12:12:35 -0400
commit7fa367d96bb1ae25f422d6c2a78424f0f9227b5a (patch)
treed27dfe4d020d1521c9af1e862c003273df6c300c /src/include
parentecd4dd9f1df00ef9e872a4d13bbbe3f3d8d3f966 (diff)
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')
-rw-r--r--src/include/nodes/parsenodes.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index 557074c2cf1..b907e972072 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -915,10 +915,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*