From: 邱宇航 <iamqyh@gmail.com>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Inconsistent Behavior of GROUP BY ROLLUP in v17 vs master
Date: Tue, 23 Sep 2025 11:48:58 +0800
Message-ID: <0879D9C9-7FE2-4A20-9593-B23F7A0B5290@gmail.com> (raw)
I've noticed that two GROUP BY ROLLUP queries behave differently in v17
compared to master and REL_18_STABLE. The issue can be reproduced by
following SQL:
``` SQL
CREATE TABLE t(id int);
INSERT INTO t SELECT generate_series(1, 3);
-- Query 1
SELECT DISTINCT 'XXX'
FROM t
GROUP BY ROLLUP (id, 1);
-- Query 2
SELECT 'XXX'
FROM t
GROUP BY ROLLUP(id)
HAVING NOT (NULL IS NULL);
```
After some git bisect work, I traced the root cause:
- The first issue was introduced by commit f5050f79 (Mark expressions
nullable by grouping sets).
- The second issue stems from commit 67a54b9e (Allow pushdown of HAVING
clauses with grouping sets).
Best regards,
Yuhang Qiu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: iamqyh@gmail.com
Subject: Re: Inconsistent Behavior of GROUP BY ROLLUP in v17 vs master
In-Reply-To: <0879D9C9-7FE2-4A20-9593-B23F7A0B5290@gmail.com>
References: <0879D9C9-7FE2-4A20-9593-B23F7A0B5290@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox