diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2014-01-07 15:25:19 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2014-01-07 15:25:19 -0500 |
commit | 0a43e5466ca03fce433309c6de2a4272b79c1abb (patch) | |
tree | 1825171721464cb544277cf827fa02b6b273afb0 /src/backend/parser/parse_clause.c | |
parent | 91c2755fcbd701067702cc889deeddddc6ff7a92 (diff) | |
download | postgresql-0a43e5466ca03fce433309c6de2a4272b79c1abb.tar.gz postgresql-0a43e5466ca03fce433309c6de2a4272b79c1abb.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_clause.c')
-rw-r--r-- | src/backend/parser/parse_clause.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/backend/parser/parse_clause.c b/src/backend/parser/parse_clause.c index a9ecc2399db..f2c506f940c 100644 --- a/src/backend/parser/parse_clause.c +++ b/src/backend/parser/parse_clause.c @@ -207,6 +207,10 @@ setTargetTable(ParseState *pstate, RangeVar *relation, /* * If UPDATE/DELETE, add table to joinlist and namespace. + * + * 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. */ if (alsoSource) addRTEtoQuery(pstate, rte, true, true, true); |