Re: An oversight in ExecInitAgg for grouping sets

2023-04-11 Thread David Rowley
On Mon, 9 Jan 2023 at 22:21, David Rowley wrote: > One extra thing I noticed was that I had to add a new > VALGRIND_MAKE_MEM_DEFINED in AllocSetAlloc when grabbing an item off > the freelist. I didn't quite manage to figure out why that's needed as > when we do AllocSetFree() we don't mark the

Re: An oversight in ExecInitAgg for grouping sets

2023-03-22 Thread David Rowley
On Mon, 20 Mar 2023 at 19:18, Richard Guo wrote: > It occurred to me that this hasn't been applied. Should we add it to > the CF to not lose track of it? I have a git branch with it. That'll work for me personally as a reminder to come back to it during the v17 cycle. David

Re: An oversight in ExecInitAgg for grouping sets

2023-03-20 Thread Richard Guo
On Mon, Jan 9, 2023 at 5:21 PM David Rowley wrote: > On Thu, 5 Jan 2023 at 20:06, Richard Guo wrote: > > I reviewed this patch and have some comments. > > Thanks for looking at this. I think I've fixed all the issues you > mentioned. > > One extra thing I noticed was that I had to add a new >

Re: An oversight in ExecInitAgg for grouping sets

2023-01-09 Thread David Rowley
On Thu, 5 Jan 2023 at 20:06, Richard Guo wrote: > I reviewed this patch and have some comments. Thanks for looking at this. I think I've fixed all the issues you mentioned. One extra thing I noticed was that I had to add a new VALGRIND_MAKE_MEM_DEFINED in AllocSetAlloc when grabbing an item off

Re: An oversight in ExecInitAgg for grouping sets

2023-01-04 Thread Richard Guo
On Thu, Jan 5, 2023 at 6:18 AM David Rowley wrote: > On Tue, 3 Jan 2023 at 10:25, Tom Lane wrote: > > The thing that I find really distressing here is that it's been > > like this for years and none of our automated testing caught it. > > You'd have expected valgrind testing to do so ... but it

Re: An oversight in ExecInitAgg for grouping sets

2023-01-04 Thread David Rowley
On Tue, 3 Jan 2023 at 10:25, Tom Lane wrote: > The thing that I find really distressing here is that it's been > like this for years and none of our automated testing caught it. > You'd have expected valgrind testing to do so ... but it does not, > because we've never marked that word NOACCESS.

Re: An oversight in ExecInitAgg for grouping sets

2023-01-03 Thread Richard Guo
On Tue, Jan 3, 2023 at 5:25 AM Tom Lane wrote: > Agreed, that's a latent bug. It's only latent because the word just > before a palloc chunk will never be zero, either in our historical > palloc code or in v16's shiny new implementation. Nonetheless it > is a horrible idea for ExecInitAgg to

Re: An oversight in ExecInitAgg for grouping sets

2023-01-02 Thread Tom Lane
Richard Guo writes: > On Thu, Dec 22, 2022 at 2:02 PM Richard Guo wrote: >> If it is an empty grouping set, its length will be zero, and accessing >> phasedata->eqfunctions[length - 1] is not right. > Attached is a trivial patch for the fix. Agreed, that's a latent bug. It's only latent

Re: An oversight in ExecInitAgg for grouping sets

2022-12-26 Thread Richard Guo
On Thu, Dec 22, 2022 at 2:02 PM Richard Guo wrote: > I happened to notice $subject. It happens when we build eqfunctions for > each grouping set. > > /* for each grouping set */ > for (int k = 0; k < phasedata->numsets; k++) > { > int length =

An oversight in ExecInitAgg for grouping sets

2022-12-21 Thread Richard Guo
I happened to notice $subject. It happens when we build eqfunctions for each grouping set. /* for each grouping set */ for (int k = 0; k < phasedata->numsets; k++) { int length = phasedata->gset_lengths[k]; if (phasedata->eqfunctions[length - 1] != NULL)