Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit59fd249

Browse files
committed
Remove ancient kluge that kept nodeAgg.c from crashing on UPDATEs involving
aggregates. We just disallowed that, and AFAICS there should be no othercases where direct (non-aggregated) references to input columns are allowedin a query with aggregation and no GROUP BY.
1 parent1f5ca04 commit59fd249

File tree

1 file changed

+5
-25
lines changed

1 file changed

+5
-25
lines changed

‎src/backend/executor/nodeAgg.c

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
* Portions Copyright (c) 1994, Regents of the University of California
6262
*
6363
* IDENTIFICATION
64-
* $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.139 2006/04/04 19:35:34 tgl Exp $
64+
* $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.140 2006/06/21 18:39:42 tgl Exp $
6565
*
6666
*-------------------------------------------------------------------------
6767
*/
@@ -831,32 +831,12 @@ agg_retrieve_direct(AggState *aggstate)
831831
&aggvalues[aggno],&aggnulls[aggno]);
832832
}
833833

834-
/*
835-
* If we have no first tuple (ie, the outerPlan didn't return
836-
* anything), create a dummy all-nulls input tuple for use by
837-
* ExecQual/ExecProject. 99.44% of the time this is a waste of cycles,
838-
* because ordinarily the projected output tuple's targetlist cannot
839-
* contain any direct (non-aggregated) references to input columns, so
840-
* the dummy tuple will not be referenced. However there are special
841-
* cases where this isn't so --- in particular an UPDATE involving an
842-
* aggregate will have a targetlist reference to ctid.We need to
843-
* return a null for ctid in that situation, not coredump.
844-
*
845-
* The values returned for the aggregates will be the initial values
846-
* of the transition functions.
847-
*/
848-
if (TupIsNull(firstSlot))
849-
{
850-
/* Should only happen in non-grouped mode */
851-
Assert(node->aggstrategy==AGG_PLAIN);
852-
Assert(aggstate->agg_done);
853-
854-
ExecStoreAllNullTuple(firstSlot);
855-
}
856-
857834
/*
858835
* Use the representative input tuple for any references to
859-
* non-aggregated input columns in the qual and tlist.
836+
* non-aggregated input columns in the qual and tlist. (If we are
837+
* not grouping, and there are no input rows at all, we will come
838+
* here with an empty firstSlot ... but if not grouping, there can't
839+
* be any references to non-aggregated input columns, so no problem.)
860840
*/
861841
econtext->ecxt_scantuple=firstSlot;
862842

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp