Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f11lK-0003sG-D8 for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Mar 2018 03:28:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f11lI-0008CN-OQ for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Mar 2018 03:28:32 +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.89) (envelope-from ) id 1f11lI-0008CD-Dg for pgsql-hackers@lists.postgresql.org; Wed, 28 Mar 2018 03:28:32 +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.89) (envelope-from ) id 1f11lB-0000gh-Oa for pgsql-hackers@postgresql.org; Wed, 28 Mar 2018 03:28:31 +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 w2S3SJB5019217; Tue, 27 Mar 2018 23:28:19 -0400 From: Tom Lane To: Tomas Vondra cc: David Rowley , Stephen Frost , Andres Freund , PostgreSQL-development Subject: Re: Parallel Aggregates for string_agg and array_agg In-reply-to: <452e8b7f-418b-4e61-c212-c0e4410b94ad@2ndquadrant.com> References: <24abe018-b3c6-2117-b5b9-39e660db00bd@2ndquadrant.com> <1b6ee15c-c218-761e-0120-c1ed438e2db2@2ndquadrant.com> <657be73a-a21d-0ae1-5c62-870afbdfddd4@2ndquadrant.com> <20180326022647.GL24540@tamriel.snowman.net> <20180326132009.GN24540@tamriel.snowman.net> <6538.1522096067@sss.pgh.pa.us> <25812.1522108164@sss.pgh.pa.us> <452e8b7f-418b-4e61-c212-c0e4410b94ad@2ndquadrant.! com> Comments: In-reply-to Tomas Vondra message dated "Wed, 28 Mar 2018 02:06:37 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <19215.1522207699.1@sss.pgh.pa.us> Date: Tue, 27 Mar 2018 23:28:19 -0400 Message-ID: <19216.1522207699@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Tomas Vondra writes: > On 03/27/2018 04:51 AM, David Rowley wrote: >> Seems I didn't mean "trans types". I should have said aggregate >> function argument types. > I'm not sure that's better than the check proposed by Tom. An argument > type without send/receive function does not necessarily mean we can't > serialize/deserialize the trans value. Because who says the argument > value will be embedded in the trans value? In general we would not know that, but *for these specific serial/ deserial functions*, we know exactly what they will do. Also, IIRC, the trans type is declared as INTERNAL, so we don't really have any hope of identifying the behavior by inspecting that type declaration. Getting a solution that would work for other polymorphic serialization functions seems like a bit of a research project to me. In the meantime, I think David's right that what we need to look at is the actual input type of the aggregate, and then assume that what's to be serialized is an array of that. Conceivably an aggregate could be built that uses these serial/deserial functions and yet its input type is something else than what it constructs an array of ... but I find it a bit hard to wrap my brain around what that would be exactly. regards, tom lane