Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cJ5P3-0007Ou-6g for pgsql-bugs@arkaria.postgresql.org; Mon, 19 Dec 2016 21:23:25 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cJ5P1-0004xP-FZ for pgsql-bugs@arkaria.postgresql.org; Mon, 19 Dec 2016 21:23:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cJ5OL-0004EM-Mq for pgsql-bugs@postgresql.org; Mon, 19 Dec 2016 21:22:41 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cJ5OH-0007Nj-S0 for pgsql-bugs@postgresql.org; Mon, 19 Dec 2016 21:22:40 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id uBJLMO0U021374; Mon, 19 Dec 2016 16:22:24 -0500 From: Tom Lane To: Heikki Linnakangas cc: Pg Bugs , David Rowley Subject: Re: Crash with a CUBE query on 9.6 In-reply-to: <8821dc7b-50e0-b983-1590-344108b20855@iki.fi> References: <4846.1482176240@sss.pgh.pa.us> <8821dc7b-50e0-b983-1590-344108b20855@iki.fi> Comments: In-reply-to Heikki Linnakangas message dated "Mon, 19 Dec 2016 22:49:10 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <21372.1482182544.1@sss.pgh.pa.us> Date: Mon, 19 Dec 2016 16:22:24 -0500 Message-ID: <21373.1482182544@sss.pgh.pa.us> X-Pg-Spam-Score: -5.0 (-----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Heikki Linnakangas writes: > On 12/19/2016 09:37 PM, Tom Lane wrote: >> 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. > Yes, that seems straightforward. I came up with the attached. Will > commit tomorrow, barring objections. Code patch looks reasonable, but I do not get a crash on the proposed test case with current code. I suspect that integer avg() and sum() don't actually share transstates, making the test case a bit off-point. 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