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

Commit0e20abd

Browse files
committed
Fix an Assert that turns out to be reachable after all.
estimate_num_groups() gets unhappy withcreate table empty();select * from empty except select * from empty e2;I can't see any actual use-case for such a query (and the table is illegalper SQL spec), but it seems like a good idea that it not cause an assertfailure.
1 parent88e0715 commit0e20abd

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

‎src/backend/utils/adt/selfuncs.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3068,8 +3068,13 @@ estimate_num_groups(PlannerInfo *root, List *groupExprs, double input_rows)
30683068
doublenumdistinct;
30693069
ListCell*l;
30703070

3071-
/* We should not be called unless query has GROUP BY (or DISTINCT) */
3072-
Assert(groupExprs!=NIL);
3071+
/*
3072+
* If no grouping columns, there's exactly one group. (This can't happen
3073+
* for normal cases with GROUP BY or DISTINCT, but it is possible for
3074+
* corner cases with set operations.)
3075+
*/
3076+
if (groupExprs==NIL)
3077+
return1.0;
30733078

30743079
/*
30753080
* Count groups derived from boolean grouping expressions.For other

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp