diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 1999-11-15 02:00:15 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 1999-11-15 02:00:15 +0000 |
commit | f68e11f373de8b7b1d19203b8edac1a13a8d406d (patch) | |
tree | c4e61de2b9bd9b8dd7c70545dc861de3547294d4 /src/backend/parser/analyze.c | |
parent | 1ecb129d206f30f5813b01e1f1efe75c06febe49 (diff) | |
download | postgresql-f68e11f373de8b7b1d19203b8edac1a13a8d406d.tar.gz postgresql-f68e11f373de8b7b1d19203b8edac1a13a8d406d.zip |
Implement subselects in target lists. Also, relax requirement that
subselects can only appear on the righthand side of a binary operator.
That's still true for quantified predicates like x = ANY (SELECT ...),
but a subselect that delivers a single result can now appear anywhere
in an expression. This is implemented by changing EXPR_SUBLINK sublinks
to represent just the (SELECT ...) expression, without any 'left hand
side' or combining operator --- so they're now more like EXISTS_SUBLINK.
To handle the case of '(x, y, z) = (SELECT ...)', I added a new sublink
type MULTIEXPR_SUBLINK, which acts just like EXPR_SUBLINK used to.
But the grammar will only generate one for a multiple-left-hand-side
row expression.
Diffstat (limited to 'src/backend/parser/analyze.c')
-rw-r--r-- | src/backend/parser/analyze.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c index b83e1372962..4ad72439b36 100644 --- a/src/backend/parser/analyze.c +++ b/src/backend/parser/analyze.c @@ -5,7 +5,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: analyze.c,v 1.123 1999/11/07 23:08:10 momjian Exp $ + * $Id: analyze.c,v 1.124 1999/11/15 02:00:09 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -231,11 +231,11 @@ transformDeleteStmt(ParseState *pstate, DeleteStmt *stmt) /* fix where clause */ qry->qual = transformWhereClause(pstate, stmt->whereClause, NULL); - qry->hasSubLinks = pstate->p_hasSubLinks; qry->rtable = pstate->p_rtable; qry->resultRelation = refnameRangeTablePosn(pstate, stmt->relname, NULL); + qry->hasSubLinks = pstate->p_hasSubLinks; qry->hasAggs = pstate->p_hasAggs; if (pstate->p_hasAggs) parseCheckAggregates(pstate, qry); @@ -423,6 +423,9 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt) if (stmt->forUpdate != NULL) transformForUpdate(qry, stmt->forUpdate); + /* in case of subselects in default clauses... */ + qry->hasSubLinks = pstate->p_hasSubLinks; + return (Query *) qry; } |