mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-03 12:06:54 +02:00
Fix an Assert that turns out to be reachable after all.
estimate_num_groups() gets unhappy with create 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 illegal per SQL spec), but it seems like a good idea that it not cause an assert failure.
This commit is contained in:
parent
d515365a61
commit
65fd91333e
@ -3182,8 +3182,13 @@ estimate_num_groups(PlannerInfo *root, List *groupExprs, double input_rows)
|
|||||||
double numdistinct;
|
double numdistinct;
|
||||||
ListCell *l;
|
ListCell *l;
|
||||||
|
|
||||||
/* We should not be called unless query has GROUP BY (or DISTINCT) */
|
/*
|
||||||
Assert(groupExprs != NIL);
|
* If no grouping columns, there's exactly one group. (This can't happen
|
||||||
|
* for normal cases with GROUP BY or DISTINCT, but it is possible for
|
||||||
|
* corner cases with set operations.)
|
||||||
|
*/
|
||||||
|
if (groupExprs == NIL)
|
||||||
|
return 1.0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Count groups derived from boolean grouping expressions. For other
|
* Count groups derived from boolean grouping expressions. For other
|
||||||
|
Loading…
Reference in New Issue
Block a user