Re: BUG #19835: view with GROUP BY ROLLUP over duplicate columns changes results after dump/restore

From: Ishjaap Singh <ishjaap(dot)singh07(at)gmail(dot)com>
To: 125atishprak(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19835: view with GROUP BY ROLLUP over duplicate columns changes results after dump/restore
Date: 2026-12-03 08:34:14
Message-ID: CA+Y2BmcJXWAEuzapdP6GHJ4C0YBbwkubEvjULRjN2cU5kiyDKw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi Atish,

Thanks for the report. I can reproduce it on 15 to 19 and on master,
also with CUBE, GROUPING SETS, an expression, and a plain item next to
a ROLLUP.

Your patch wasn't attached (the bug form can't take files), so I wrote
one along the lines you described. Happy to compare if you post yours.
It prints a grouping set item as its column number when an earlier
output column has an equal expression, so your view comes out as
GROUP BY ROLLUP(a, 2). Everything else prints as before. The new test
in groupingsets.sql recreates a view from its pg_get_viewdef() output
and checks that the rows match. It fails without the fix, and make
check passes.

The patch is against master and applies to 16 to 19. I can post
backpatches if that helps.

Regards,
Ishjaap Singh

Attachment Content-Type Size
v1-0001-Fix-deparsing-of-grouping-sets-over-duplicate-out.patch application/octet-stream 5.9 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Amit Langote 2026-12-03 09:05:20 Re: BUG #19872: JSON_TABLE: an UNUSED PASSING argument's COLLATE leaks into the output columns (wrong results, persi
Previous Message Ishjaap Singh 2026-12-03 07:26:06 Re: BUG #19958: jsonpath: a word directly followed by a /* comment */ is silently dropped, so strict becomes lax