Re: BUG #14344: string_agg(DISTINCT ..) crash

From: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Geoghegan <pg(at)heroku(dot)com>
Cc: Regina Obe <lr(at)pcorp(dot)us>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14344: string_agg(DISTINCT ..) crash
Date: 2016-09-29 05:41:21
Message-ID: CAKJS1f9mu3NpZaYhD2z5Cr1fTx=dYqXqi8BW1NCnfXF17E=Hvw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 29 September 2016 at 17:36, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> On Wed, Sep 28, 2016 at 9:28 PM, Regina Obe <lr(at)pcorp(dot)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(at)postgresql(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2016-09-29 07:31:16 Re: BUG #14243: pg_basebackup failes by a STATUS_DELETE_PENDING file
Previous Message digoal 2016-09-29 05:35:45 BUG #14345: run multi-PG9.6 on One Host, hang when checkpoint