Re: BUG #19772: ERROR: corrupt MVNDistinct entry for GROUP BY c0, ROLLUP (abs(c0)) with ndistinct statistics

From: Aleksander Alekseev <aleksander(at)tigerdata(dot)com>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: Matheus Alcantara <matheusssilv97(at)gmail(dot)com>, alpkeles99(at)gmail(dot)com, Richard Guo <guofenglinux(at)gmail(dot)com>
Subject: Re: BUG #19772: ERROR: corrupt MVNDistinct entry for GROUP BY c0, ROLLUP (abs(c0)) with ndistinct statistics
Date: 2026-11-16 10:45:34
Message-ID: CAJ7c6TNSVFhZtiNfztW3qiiis=AGYu+v0-eobFreTCRZPny6ug@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi Matheus,

> The attached patch fixes this by also stripping the grouping step's RT
> index wherever selfuncs.c already strips the outer join nullingrels
> before looking up statistics.

I reviewed v1. It applies cleanly and the tests pass. Your analysis
matches what I see. The three new cases do fail with "corrupt
MVNDistinct entry" without the fix.

However, only add_unique_group_var() is covered. If I revert the
examine_variable() and estimate_multivariate_bucketsize() but keep the
tests, the whole regression suite still passes.

--
Best regards,
Aleksander Alekseev

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tor Erik Linnerud 2026-11-16 11:26:36 PG 18 JIT regression: int4range hash breaks multi-key GROUP BY
Previous Message Magnus Hagander 2026-11-16 10:26:14 Re: Timing issue in pg_basebackup