Re: Inconsistent Behavior of GROUP BY ROLLUP in v17 vs master

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: 邱宇航 <iamqyh(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Inconsistent Behavior of GROUP BY ROLLUP in v17 vs master
Date: 2025-09-23 11:58:56
Message-ID: aNKLgI6ZteryWZJ-@momjian.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 23, 2025 at 07:38:14PM +1200, David Rowley wrote:
> On Tue, 23 Sept 2025 at 15:49, 邱宇航 <iamqyh(at)gmail(dot)com> wrote:
> > 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:
> >
> > 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).
>
> If you check the release notes and the commit message for f5050f795
> you'll see that it does mention that wrong results could be returned.
>
> What wasn't mentioned was that this wasn't fixed in prior versions.
> The reason being is that the fix required changing the query tree
> representation, which we can't change in the back branches due to
> incompatibility with stored rules in existing databases. So, a change
> in query results for certain queries here is expected.

Uh, by design, items mentioned in the major release notes have _not_
been fixed in previous minor versions. Not sure if we can make that
clearer to users. I did write a blog about this:

https://momjian.us/main/blogs/pgblog/2022.html#June_13_2022

--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com

Do not let urgent matters crowd out time for investment in the future.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Karina Litskevich 2025-09-23 11:59:19 Re: pg_stat_statements: faster search by queryid
Previous Message Mihail Nikalayeu 2025-09-23 11:13:18 Re: bt_index_parent_check and concurrently build indexes