Re: BUG #14344: string_agg(DISTINCT ..) crash - Mailing list pgsql-bugs

From David Rowley
Subject Re: BUG #14344: string_agg(DISTINCT ..) crash
Date
Msg-id CAKJS1f9mu3NpZaYhD2z5Cr1fTx=dYqXqi8BW1NCnfXF17E=Hvw@mail.gmail.com
Whole thread Raw
In response to Re: BUG #14344: string_agg(DISTINCT ..) crash  (Michael Paquier <michael.paquier@gmail.com>)
Responses Re: BUG #14344: string_agg(DISTINCT ..) crash  (David Rowley <david.rowley@2ndquadrant.com>)
Re: BUG #14344: string_agg(DISTINCT ..) crash  (Peter Geoghegan <pg@heroku.com>)
List pgsql-bugs
On 29 September 2016 at 17:36, Michael Paquier
<michael.paquier@gmail.com> wrote:
> On Wed, Sep 28, 2016 at 9:28 PM, Regina Obe <lr@pcorp.us> wrote:
>> I'll compile against the latest 9.6 branch then and see if it crashes there
>> too.  Might be windows specific perhaps.
>
> Confirmed. I got the same trace.That's an aggregate bug in the executor.

hmm, I would be surprised about that. The planner would never generate
a parallel aggregate plan for that given that string_agg has no
combine function, and there's also a DISTINCT in there, which is never
made parallel. The code for the non parallel case is not really
changed very much in 9.6.
My guess would be a sorting bug...

Let me check....

Looks like:

commit 0011c0091e886b874e485a46ff2c94222ffbf550
Author: Robert Haas <rhaas@postgresql.org>
Date:   Thu Mar 17 16:05:05 2016 -0400

    Improve memory management for external sorts.

    Introduce a new memory context which stores tuple data, and reset it
    at the end of each merge pass; this helps avoid memory fragmentation
    and, consequently, overallocation.  Also, for the final merge patch,
    eliminate memory context chunk header overhead entirely by allocating
    all of the memory used for buffering tuples during the merge in a
    single chunk.  Since this modestly increases the number of tuples we
    can store, grow the memtuples array a bit so that we're less likely to
    run short of slots there.

    Peter Geoghegan.  Review and testing of patches in this series by
    Jeff Janes, Greg Stark, Mithun Cy, and me.




--
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

pgsql-bugs by date:

Previous
From: digoal@126.com
Date:
Subject: BUG #14345: run multi-PG9.6 on One Host, hang when checkpoint
Next
From: Michael Paquier
Date:
Subject: Re: BUG #14243: pg_basebackup failes by a STATUS_DELETE_PENDING file