-- test pushdown of degenerate HAVING clause
explain (costs off)
select count(*) from gstest2 group by grouping sets (()) having false;
- QUERY PLAN
------------------------------------
+ QUERY PLAN
+--------------------------------
Aggregate
Group Key: ()
Filter: false
-> Result
- Replaces: Scan on gstest2
One-Time Filter: false
-(6 rows)
+(5 rows)
select count(*) from gstest2 group by grouping sets (()) having false;
count
explain (costs off)
select a, count(*) from gstest2 group by grouping sets ((a), ()) having false;
- QUERY PLAN
------------------------------------------
+ QUERY PLAN
+--------------------------------------
GroupAggregate
Group Key: a
Group Key: ()
-> Sort
Sort Key: a
-> Result
- Replaces: Scan on gstest2
One-Time Filter: false
-(9 rows)
+(8 rows)
select a, count(*) from gstest2 group by grouping sets ((a), ()) having false;
a | count
explain (costs off)
select a, b, count(*) from gstest2 group by grouping sets ((a), (b)) having false;
- QUERY PLAN
------------------------------------------
+ QUERY PLAN
+--------------------------------------
GroupAggregate
Group Key: a
Sort Key: b
-> Sort
Sort Key: a
-> Result
- Replaces: Scan on gstest2
One-Time Filter: false
-(9 rows)
+(8 rows)
select a, b, count(*) from gstest2 group by grouping sets ((a), (b)) having false;
a | b | count