From: Tom Lane <tgl@sss.pgh.pa.us>
To: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Pg Bugs <pgsql-bugs@postgresql.org>
Cc: David Rowley <david.rowley@2ndquadrant.com>
Subject: Re: Crash with a CUBE query on 9.6
Date: Mon, 19 Dec 2016 14:37:20 -0500
Message-ID: <4846.1482176240@sss.pgh.pa.us> (raw)
In-Reply-To: <ac5b0b69-744c-9114-6218-8300ac920e61@iki.fi>
References: <ac5b0b69-744c-9114-6218-8300ac920e61@iki.fi>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
Heikki Linnakangas <hlinnaka@iki.fi> writes:
> The attached test case crashes on REL9_6_STABLE and master. On 9.5, it
> worked.
As best I can tell, this is the fault of commit 804163bc2. The problem
query can be simplified to
SELECT
STDDEV(DISTINCT floor(sale.cn)),
AVG(DISTINCT floor(sale.cn))
FROM sale,vendor
WHERE sale.vn=vendor.vn
GROUP BY CUBE((sale.cn,sale.dt,sale.dt),(sale.pn,sale.prc),(sale.qty,sale.vn)),sale.qty order by 1,2 ;
The two aggregates share a "pertrans" state, but finalize_aggregates
does not account for that and calls process_ordered_aggregate_single()
twice on the same pertrans state. The second time crashes because we
already deleted the tuplesort object the first time.
Probably, the loop in finalize_aggregates needs to be split into two,
one over the pertrans states and then a second one over the peragg states.
But this code has been hacked up enough since I last looked at it that
I'm hesitant to try to fix it myself.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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: tgl@sss.pgh.pa.us, hlinnaka@iki.fi, david.rowley@2ndquadrant.com
Subject: Re: Crash with a CUBE query on 9.6
In-Reply-To: <4846.1482176240@sss.pgh.pa.us>
References: <ac5b0b69-744c-9114-6218-8300ac920e61@iki.fi> <4846.1482176240@sss.pgh.pa.us>
* 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