aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/plan/planner.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1998-01-15 19:00:16 +0000
committerBruce Momjian <bruce@momjian.us>1998-01-15 19:00:16 +0000
commit763ff8aef848d71da079049890786edffc3302d6 (patch)
treea1aed2a633c409071dd6d724b6db2bc7bf4fcb75 /src/backend/optimizer/plan/planner.c
parentf22d8e6668e36a5855c35b04cc21a4d1593298d9 (diff)
downloadpostgresql-763ff8aef848d71da079049890786edffc3302d6.tar.gz
postgresql-763ff8aef848d71da079049890786edffc3302d6.zip
Remove Query->qry_aggs and qry_numaggs and replace with Query->hasAggs.
Pass List* of Aggregs into executor, and create needed array there. No longer need to double-processs Aggregs with second copy in Query. Fix crash when doing: select sum(x+1) from test where 1 > 0;
Diffstat (limited to 'src/backend/optimizer/plan/planner.c')
-rw-r--r--src/backend/optimizer/plan/planner.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index 77419112d74..5643b675f96 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.20 1998/01/07 21:04:05 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.21 1998/01/15 18:59:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -117,7 +117,7 @@ planner(Query *parse)
* If we have a GROUP BY clause, insert a group node (with the
* appropriate sort node.)
*/
- if (parse->groupClause != NULL)
+ if (parse->groupClause)
{
bool tuplePerGroup;
@@ -127,7 +127,7 @@ planner(Query *parse)
* present. Otherwise, need every tuple from the group to do the
* aggregation.)
*/
- tuplePerGroup = (parse->qry_aggs) ? TRUE : FALSE;
+ tuplePerGroup = parse->hasAggs;
result_plan =
make_groupPlan( &tlist,
@@ -140,22 +140,16 @@ planner(Query *parse)
/*
* If aggregate is present, insert the agg node
*/
- if (parse->qry_aggs)
+ if (parse->hasAggs)
{
- result_plan = (Plan *)make_agg(tlist,
- parse->qry_numAgg,
- parse->qry_aggs,
- result_plan);
+ result_plan = (Plan *)make_agg(tlist, result_plan);
/*
* set the varno/attno entries to the appropriate references to
- * the result tuple of the subplans. (We need to set those in the
- * array of aggreg's in the Agg node also. Even though they're
- * pointers, after a few dozen's of copying, they're not the same
- * as those in the target list.)
+ * the result tuple of the subplans.
*/
- set_agg_tlist_references((Agg *)result_plan);
- set_agg_agglist_references((Agg *)result_plan);
+ ((Agg *)result_plan)->aggs =
+ set_agg_tlist_references((Agg *)result_plan);
}
/*