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

Commit2e5fe48

Browse files
committed
Repair optimization bug I introduced in a moment of brain fade back in
Nov 2002: when constant-expression simplification removes all theaggregate function calls from a query, that doesn't mean we can act asthough there never were any aggregates. Per bug report from Gabor Szucs.
1 parentf884090 commit2e5fe48

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

‎src/backend/optimizer/plan/planner.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/optimizer/plan/planner.c,v 1.166 2004/02/03 17:34:03 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/optimizer/plan/planner.c,v 1.167 2004/02/13 22:26:30 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -709,19 +709,18 @@ grouping_planner(Query *parse, double tuple_fraction)
709709

710710
/*
711711
* Will need actual number of aggregates for estimating costs.
712-
* Also, it's possible that optimization has eliminated all
713-
* aggregates, and we may as well check for that here.
714712
*
715713
* Note: we do not attempt to detect duplicate aggregates here; a
716714
* somewhat-overestimated count is okay for our present purposes.
715+
*
716+
* Note: think not that we can turn off hasAggs if we find no aggs.
717+
* It is possible for constant-expression simplification to remove
718+
* all explicit references to aggs, but we still have to follow the
719+
* aggregate semantics (eg, producing only one output row).
717720
*/
718721
if (parse->hasAggs)
719-
{
720722
numAggs=count_agg_clause((Node*)tlist)+
721723
count_agg_clause(parse->havingQual);
722-
if (numAggs==0)
723-
parse->hasAggs= false;
724-
}
725724

726725
/*
727726
* Figure out whether we need a sorted result from query_planner.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp