diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/regress/expected/groupingsets.out | 21 | ||||
-rw-r--r-- | src/test/regress/sql/groupingsets.sql | 5 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/test/regress/expected/groupingsets.out b/src/test/regress/expected/groupingsets.out index 717383c4f3a..d7c9b44605d 100644 --- a/src/test/regress/expected/groupingsets.out +++ b/src/test/regress/expected/groupingsets.out @@ -860,6 +860,27 @@ explain (costs off) -> Seq Scan on gstest2 (10 rows) +-- test pushdown of HAVING clause that does not reference any columns that are nullable by grouping sets +explain (costs off) +select a, b, count(*) from gstest2 group by grouping sets ((a, b), (a)) having a > 1 and b > 1; + QUERY PLAN +--------------------------------- + GroupAggregate + Group Key: a, b + Group Key: a + Filter: (b > 1) + -> Sort + Sort Key: a, b + -> Seq Scan on gstest2 + Filter: (a > 1) +(8 rows) + +select a, b, count(*) from gstest2 group by grouping sets ((a, b), (a)) having a > 1 and b > 1; + a | b | count +---+---+------- + 2 | 2 | 1 +(1 row) + -- HAVING with GROUPING queries select ten, grouping(ten) from onek group by grouping sets(ten) having grouping(ten) >= 0 diff --git a/src/test/regress/sql/groupingsets.sql b/src/test/regress/sql/groupingsets.sql index 660ca33efc1..21cd3121940 100644 --- a/src/test/regress/sql/groupingsets.sql +++ b/src/test/regress/sql/groupingsets.sql @@ -279,6 +279,11 @@ explain (costs off) select v.c, (select count(*) from gstest2 group by () having v.c) from (values (false),(true)) v(c) order by v.c; +-- test pushdown of HAVING clause that does not reference any columns that are nullable by grouping sets +explain (costs off) +select a, b, count(*) from gstest2 group by grouping sets ((a, b), (a)) having a > 1 and b > 1; +select a, b, count(*) from gstest2 group by grouping sets ((a, b), (a)) having a > 1 and b > 1; + -- HAVING with GROUPING queries select ten, grouping(ten) from onek group by grouping sets(ten) having grouping(ten) >= 0 |