diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-06-21 18:39:42 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-06-21 18:39:42 +0000 |
commit | 59fd249a300d4dbf0b0388ea943e666ad6ab2f95 (patch) | |
tree | ee8362e031b83a21db1fb9fd620c6bce13165ccb /src | |
parent | 1f5ca045a435bc6aa9c98d7296973925c5208add (diff) | |
download | postgresql-59fd249a300d4dbf0b0388ea943e666ad6ab2f95.tar.gz postgresql-59fd249a300d4dbf0b0388ea943e666ad6ab2f95.zip |
Remove ancient kluge that kept nodeAgg.c from crashing on UPDATEs involving
aggregates. We just disallowed that, and AFAICS there should be no other
cases where direct (non-aggregated) references to input columns are allowed
in a query with aggregation and no GROUP BY.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/executor/nodeAgg.c | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c index a242d53968e..dfb9938715f 100644 --- a/src/backend/executor/nodeAgg.c +++ b/src/backend/executor/nodeAgg.c @@ -61,7 +61,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.139 2006/04/04 19:35:34 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.140 2006/06/21 18:39:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -832,31 +832,11 @@ agg_retrieve_direct(AggState *aggstate) } /* - * If we have no first tuple (ie, the outerPlan didn't return - * anything), create a dummy all-nulls input tuple for use by - * ExecQual/ExecProject. 99.44% of the time this is a waste of cycles, - * because ordinarily the projected output tuple's targetlist cannot - * contain any direct (non-aggregated) references to input columns, so - * the dummy tuple will not be referenced. However there are special - * cases where this isn't so --- in particular an UPDATE involving an - * aggregate will have a targetlist reference to ctid. We need to - * return a null for ctid in that situation, not coredump. - * - * The values returned for the aggregates will be the initial values - * of the transition functions. - */ - if (TupIsNull(firstSlot)) - { - /* Should only happen in non-grouped mode */ - Assert(node->aggstrategy == AGG_PLAIN); - Assert(aggstate->agg_done); - - ExecStoreAllNullTuple(firstSlot); - } - - /* * Use the representative input tuple for any references to - * non-aggregated input columns in the qual and tlist. + * non-aggregated input columns in the qual and tlist. (If we are + * not grouping, and there are no input rows at all, we will come + * here with an empty firstSlot ... but if not grouping, there can't + * be any references to non-aggregated input columns, so no problem.) */ econtext->ecxt_scantuple = firstSlot; |