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 1f1BXZ-000275-SQ for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Mar 2018 13:55:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f1BXY-0007l4-Ja for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Mar 2018 13:55:00 +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.89) (envelope-from ) id 1f1BXP-0006gX-8D for pgsql-hackers@lists.postgresql.org; Wed, 28 Mar 2018 13:54:51 +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.89) (envelope-from ) id 1f1BXL-0005Vj-4p for pgsql-hackers@postgresql.org; Wed, 28 Mar 2018 13:54:50 +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 w2SDscTR018742; Wed, 28 Mar 2018 09:54:38 -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: 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> <19216.1522207699@sss.pgh.pa.us> Comments: In-reply-to Tomas Vondra message dated "Wed, 28 Mar 2018 14:29:11 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <18740.1522245278.1@sss.pgh.pa.us> Date: Wed, 28 Mar 2018 09:54:38 -0400 Message-ID: <18741.1522245278@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Tomas Vondra writes: > On 03/28/2018 05:28 AM, Tom Lane wrote: >> 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. > But David's fix doesn't check the aggregate to produce an array of the > input type (or anyarray). It could easily be an aggregate computing a > bloom filter or something like that, which has no such issues in the > serial/deserial functions. Oh, if he's not restricting it to these serialization functions, I agree that seems wrong. I thought the discussion was about what to do after checking the functions. > Also, if it's checking aggref->aggargtypes, it'll reject anyelement > parameters, no? I had in mind to look at exprType() of the argument. regards, tom lane