Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFrUm-0003ls-Cr for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Jun 2016 23:23:44 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bFrUl-0006rE-Qe for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Jun 2016 23:23:43 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bFrTQ-0005M4-S4 for pgsql-hackers@postgresql.org; Wed, 22 Jun 2016 23:22:21 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bFrTO-0004X6-FZ for pgsql-hackers@postgresql.org; Wed, 22 Jun 2016 23:22:19 +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 u5MNMG2M010051; Wed, 22 Jun 2016 19:22:16 -0400 From: Tom Lane To: David Rowley cc: Robert Haas , "pgsql-hackers@postgresql.org" Subject: Re: Parallelized polymorphic aggs, and aggtype vs aggoutputtype In-reply-to: References: <8229.1466109074@sss.pgh.pa.us> <14538.1466116810@sss.pgh.pa.us> <22037.1466129876@sss.pgh.pa.us> <27247.1466185504@sss.pgh.pa.us> Comments: In-reply-to David Rowley message dated "Wed, 22 Jun 2016 15:19:02 +1200" Date: Wed, 22 Jun 2016 19:22:16 -0400 Message-ID: <10050.1466637736@sss.pgh.pa.us> X-Pg-Spam-Score: -3.3 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org David Rowley writes: > I've attached my proposed patch for the user defined aggregate docs. I whacked this around some more and pushed it. While working on that, I noticed what seems to me to be a minor bug. The behavior that I'd expect (and that I documented) for a deserialization function is that it just allocates its result in the current, short-lived memory context, since it will be the combine function's responsibility to merge that into the long-lived transition state. But it looks to me like the deserialization functions in numeric.c are allocating their results in the aggregate context, which will mean a leak. (For example, numeric_avg_deserialize creates its result using makeNumericAggState which forces the result into the agg context.) Now this leak isn't going to be real significant unless we accumulate a whole lot of partial results in one query, which would be unusual and maybe even impossible in the current parallel-query environment. But it still seems wrong. Please check, and submit a patch if I'm right about what's happening. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers