1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-07 00:36:50 +03:00

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.
This commit is contained in:
Tom Lane
1999-11-15 02:00:15 +00:00
parent 1ecb129d20
commit f68e11f373
12 changed files with 364 additions and 566 deletions

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.94 1999/11/01 05:15:13 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.95 1999/11/15 02:00:01 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -86,10 +86,11 @@ CopyPlanFields(Plan *from, Plan *newnode)
newnode->locParam = listCopy(from->locParam);
newnode->chgParam = listCopy(from->chgParam);
Node_Copy(from, newnode, initPlan);
if (from->subPlan != NULL)
newnode->subPlan = SS_pull_subplan((Node *) newnode->qual);
if (from->subPlan != NIL)
newnode->subPlan = nconc(SS_pull_subplan((Node *) newnode->targetlist),
SS_pull_subplan((Node *) newnode->qual));
else
newnode->subPlan = NULL;
newnode->subPlan = NIL;
newnode->nParamExec = from->nParamExec;
}
@ -137,8 +138,9 @@ _copyResult(Result *from)
* We must add subplans in resconstantqual to the new plan's subPlan
* list
*/
newnode->plan.subPlan = nconc(newnode->plan.subPlan,
SS_pull_subplan(newnode->resconstantqual));
if (from->plan.subPlan != NIL)
newnode->plan.subPlan = nconc(newnode->plan.subPlan,
SS_pull_subplan(newnode->resconstantqual));
return newnode;
}