summaryrefslogtreecommitdiff
path: root/src/backend/optimizer/plan/planner.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>1999-11-15 02:00:15 +0000
committerTom Lane <tgl@sss.pgh.pa.us>1999-11-15 02:00:15 +0000
commitf68e11f373de8b7b1d19203b8edac1a13a8d406d (patch)
treec4e61de2b9bd9b8dd7c70545dc861de3547294d4 /src/backend/optimizer/plan/planner.c
parent1ecb129d206f30f5813b01e1f1efe75c06febe49 (diff)
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/optimizer/plan/planner.c')
-rw-r--r--src/backend/optimizer/plan/planner.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index fce3800dc49..295d722b6a5 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.70 1999/10/07 04:23:06 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.71 1999/11/15 02:00:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -343,17 +343,11 @@ union_planner(Query *parse)
{
/* Expand SubLinks to SubPlans */
parse->havingQual = SS_process_sublinks(parse->havingQual);
-
- /*
- * Check for ungrouped variables passed to subplans. (Probably
- * this should be done for the targetlist as well??? But we
- * should NOT do it for the WHERE qual, since WHERE is
- * evaluated pre-GROUP.)
- */
+ /* Check for ungrouped variables passed to subplans */
if (check_subplans_for_ungrouped_vars(parse->havingQual,
parse->groupClause,
parse->targetList))
- elog(ERROR, "Sub-SELECT in HAVING clause must use only GROUPed attributes from outer SELECT");
+ elog(ERROR, "Sub-SELECT must use only GROUPed attributes from outer SELECT");
}
}