diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2014-01-07 15:25:16 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2014-01-07 15:25:27 -0500 |
commit | 0c051c90082da0b7e5bcaf9aabcbd4f361137cdc (patch) | |
tree | 457a1ae1db6b3f135f7a56a6d3512916687b7d34 /src/backend/parser/parse_relation.c | |
parent | f68220df92cb56f0452919f51eeef16262ec8f3b (diff) | |
download | postgresql-0c051c90082da0b7e5bcaf9aabcbd4f361137cdc.tar.gz postgresql-0c051c90082da0b7e5bcaf9aabcbd4f361137cdc.zip |
Fix LATERAL references to target table of UPDATE/DELETE.
I failed to think much about UPDATE/DELETE when implementing LATERAL :-(.
The implemented behavior ended up being that subqueries in the FROM or
USING clause (respectively) could access the update/delete target table as
though it were a lateral reference; which seems fine if they said LATERAL,
but certainly ought to draw an error if they didn't. Fix it so you get a
suitable error when you omit LATERAL. Per report from Emre Hasegeli.
Diffstat (limited to 'src/backend/parser/parse_relation.c')
-rw-r--r-- | src/backend/parser/parse_relation.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c index cd8d75e23d9..a7f563b1b14 100644 --- a/src/backend/parser/parse_relation.c +++ b/src/backend/parser/parse_relation.c @@ -1730,6 +1730,10 @@ isLockedRefname(ParseState *pstate, const char *refname) * and/or namespace list. (We assume caller has checked for any * namespace conflicts.) The RTE is always marked as unconditionally * visible, that is, not LATERAL-only. + * + * Note: some callers know that they can find the new ParseNamespaceItem + * at the end of the pstate->p_namespace list. This is a bit ugly but not + * worth complicating this function's signature for. */ void addRTEtoQuery(ParseState *pstate, RangeTblEntry *rte, |