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

Commit65fd913

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 parentd515365 commit65fd913

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
@@ -3182,8 +3182,13 @@ estimate_num_groups(PlannerInfo *root, List *groupExprs, double input_rows)
31823182
doublenumdistinct;
31833183
ListCell*l;
31843184

3185-
/* We should not be called unless query has GROUP BY (or DISTINCT) */
3186-
Assert(groupExprs!=NIL);
3185+
/*
3186+
* If no grouping columns, there's exactly one group. (This can't happen
3187+
* for normal cases with GROUP BY or DISTINCT, but it is possible for
3188+
* corner cases with set operations.)
3189+
*/
3190+
if (groupExprs==NIL)
3191+
return1.0;
31873192

31883193
/*
31893194
* Count groups derived from boolean grouping expressions.For other

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp