Re: BUG #8410: out of binary heap slots - Mailing list pgsql-bugs

From Andres Freund
Subject Re: BUG #8410: out of binary heap slots
Date
Msg-id 20130830212707.GC8932@awork2.anarazel.de
Whole thread Raw
In response to Re: BUG #8410: out of binary heap slots  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-bugs
On 2013-08-30 17:15:32 -0400, Alvaro Herrera wrote:
> Andres Freund wrote:
>
> > No need, found the bug. And I think can build a testcase myself.
> >
> > ExecReScanMergeAppend resets ms_initialized, but doesn't clear the
> > binaryheap. Thus no new elements fit.
>
> Um.  Are we missing a binaryheap_clear() method?

In the patch I am patch-to-be it's binaryheap_reset(), but yes ;). Are
you already patching it, or do you want me to finish it? I have a not so
nice testcase and I can confirm that this is the issue and that a
binaryheap_reset() fixes it:

SELECT (SELECT g.i FROM ((SELECT random()::int ORDER BY 1 OFFSET 0) UNION ALL (SELECT random()::int ORDER BY 1 OFFSET
0))f(i) ORDER BY f.i LIMIT 1) FROM generate_series(1, 10) g(i); 

Greetings,

Andres Freund

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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #8410: out of binary heap slots
Next
From: Andres Freund
Date:
Subject: Re: BUG #8410: out of binary heap slots