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

Commitbe9aad6

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 parent785d499 commitbe9aad6

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
@@ -3051,8 +3051,13 @@ estimate_num_groups(PlannerInfo *root, List *groupExprs, double input_rows)
30513051
doublenumdistinct;
30523052
ListCell*l;
30533053

3054-
/* We should not be called unless query has GROUP BY (or DISTINCT) */
3055-
Assert(groupExprs!=NIL);
3054+
/*
3055+
* If no grouping columns, there's exactly one group. (This can't happen
3056+
* for normal cases with GROUP BY or DISTINCT, but it is possible for
3057+
* corner cases with set operations.)
3058+
*/
3059+
if (groupExprs==NIL)
3060+
return1.0;
30563061

30573062
/*
30583063
* Count groups derived from boolean grouping expressions.For other

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp