aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeAgg.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2003-06-06 15:04:03 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2003-06-06 15:04:03 +0000
commite649796f128bd8702ba5744d36f4e8cb81f0b754 (patch)
tree050eda51ad8f0298731316ccf61db2c01a2863a3 /src/backend/executor/nodeAgg.c
parent2c93861f7cef99b4613abd37ed7e4c15a95754b4 (diff)
downloadpostgresql-e649796f128bd8702ba5744d36f4e8cb81f0b754.tar.gz
postgresql-e649796f128bd8702ba5744d36f4e8cb81f0b754.zip
Implement outer-level aggregates to conform to the SQL spec, with
extensions to support our historical behavior. An aggregate belongs to the closest query level of any of the variables in its argument, or the current query level if there are no variables (e.g., COUNT(*)). The implementation involves adding an agglevelsup field to Aggref, and treating outer aggregates like outer variables at planning time.
Diffstat (limited to 'src/backend/executor/nodeAgg.c')
-rw-r--r--src/backend/executor/nodeAgg.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c
index 603df5ed1c4..f2499cb4e5e 100644
--- a/src/backend/executor/nodeAgg.c
+++ b/src/backend/executor/nodeAgg.c
@@ -45,7 +45,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.105 2003/05/30 20:23:10 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.106 2003/06/06 15:04:01 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1179,6 +1179,9 @@ ExecInitAgg(Agg *node, EState *estate)
Datum textInitVal;
int i;
+ /* Planner should have assigned aggregate to correct level */
+ Assert(aggref->agglevelsup == 0);
+
/* Look for a previous duplicate aggregate */
for (i = 0; i <= aggno; i++)
{