From: Jeff Davis <pgsql@j-davis.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: exclusion@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16784: Server crash in ExecReScanAgg()
Date: Sat, 26 Dec 2020 17:50:53 -0800
Message-ID: <d7e4ba887554732f83b8bfd9990ee6894d1d450a.camel@j-davis.com> (raw)
In-Reply-To: <553495.1608578766@sss.pgh.pa.us>
References: <16784-7ff169bf2c3d1588@postgresql.org>
<553495.1608578766@sss.pgh.pa.us>
Thank you for the report, Alexander!
On Mon, 2020-12-21 at 14:26 -0500, Tom Lane wrote:
> /* there could be residual pergroup pointers; clear them */
> for (int setoff = 0;
> setoff < aggstate->maxsets + aggstate->num_hashes;
> setoff++)
> aggstate->all_pergroups[setoff] = NULL;
>
> I suspect this is clearing the wrong subset of the all_pergroups
> pointers, but the code is so underdocumented that I'm not very
> sure.
That's correct, but there was a (bad) reason it was done that way that
I had to fix first. A null pergroup was used as a signal not to advance
a group that has spilled, but that's only a good solution for the
hashed grouping sets, not the sorted grouping sets (which is what
caused this bug).
Instead, I solved it by simply not compiling the expressions for the
sorted grouping sets, so that agg_refill_hash_table() can leave those
pergroups alone.
Regards,
Jeff Davis
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-bugs@postgresql.org
Cc: pgsql@j-davis.com, tgl@sss.pgh.pa.us, exclusion@gmail.com
Subject: Re: BUG #16784: Server crash in ExecReScanAgg()
In-Reply-To: <d7e4ba887554732f83b8bfd9990ee6894d1d450a.camel@j-davis.com>
References: <16784-7ff169bf2c3d1588@postgresql.org> <553495.1608578766@sss.pgh.pa.us> <d7e4ba887554732f83b8bfd9990ee6894d1d450a.camel@j-davis.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