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 1f1Bhb-0002wj-22 for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Mar 2018 14:05:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f1BhZ-0002ah-8G for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Mar 2018 14:05:21 +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 1f1BhZ-0002a6-0F for pgsql-hackers@lists.postgresql.org; Wed, 28 Mar 2018 14:05:21 +0000 Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1f1BhQ-0005mW-T6 for pgsql-hackers@postgresql.org; Wed, 28 Mar 2018 14:05:20 +0000 Received: by mail-wm0-x22d.google.com with SMTP id l16so5578217wmh.3 for ; Wed, 28 Mar 2018 07:05:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=CrUn4drKMC8X3MHEFGrKEe9aFMGSTL+TcJPc2UFYdMM=; b=1AoEsYk2wSOVK7doi5pt+RqH731V4ZV/eeeiLuUTKCgn4pN/rxCfG7KA+bZ/hsiJvv 5SseAR1BHO6K6eRzcY/xwbAQ87fkaYtmnkLa6x+/Wc2LVw/RVnWaPl7TSV82PaTML4vE 5HvfB0bG+u+7N6bhf12Bf7kSkGhotaB7gOXk2QVdMXvWp4gNlAz1iWGPaRY4QlLygf/z sHq3N7SGwMGusSxawXYgmPnqebHglIA92nm9s7IpH9NzAy+5ExNAQSi9c8NmOBEFM9l0 XCIjJYtkainnDZOEXs6K1adByr6yQhauTlP6UAsmx2y6oGUySKa6tWUtS5QVrFEX8V+j BViQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=CrUn4drKMC8X3MHEFGrKEe9aFMGSTL+TcJPc2UFYdMM=; b=ZvgBizFC3KYCXWkAi8quvnjqYEGEnO8VZ6mtHTHwa6QfIk0kJZRGnuEvY2NgFOPetU afezT3NCQdM/hl8E4RScLUILPjowPtVgPcp/7hGLz9yttxJTA1AxcvvPzOOMfJLIlLDB CSAadU3p7jt4TJEF7YO9u2RR+keJVB5lPPizOnPU0lrdOujZQ83IoQuP7OtvnGl9OGu9 7xyUyF5h3hjm5uQh5CHvAO/Yac8+MJw86Z1ZPWyIz50Hom5wJZPfhWVr0Z629Z70lVd9 n8r4qizmEbMxMwYV6r619oVtuIXQVU4wq8kegvhpUejrDcDSZqcUE9GxYXM/PYg4i1P4 PbWg== X-Gm-Message-State: AElRT7Fts6mYGb54R5VDRwyucgbTct61LXPmbvYQPfzBYSwY2URzrdq0 XaQ/ure9XPycq/OrlaNM1+H56CEKL/NLRPcjVVfeOcH9ZtftBIXNcXMTCJjCuwdUDtZY+/O1QN6 drle4ja9OEJI8JWnUFC98mBGNje708qXiUmdsNMcIcxpKc6jaWk9S3d7w3IND1lWnOwWXxHezbc HfOp5PTs5N X-Google-Smtp-Source: AIpwx49Gsoz3XM1Xc3lqLsS+uqgfrSK4CETzLhIy9OdeDkc94rWmpNH9VbGNMVBMbP6ow4gl01KL0A== X-Received: by 10.80.182.112 with SMTP id c45mr3593773ede.219.1522245910328; Wed, 28 Mar 2018 07:05:10 -0700 (PDT) Received: from [10.137.2.19] (ip-78-102-97-226.net.upcbroadband.cz. [78.102.97.226]) by smtp.gmail.com with ESMTPSA id d22sm2661100eda.31.2018.03.28.07.05.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Mar 2018 07:05:08 -0700 (PDT) Subject: Re: Parallel Aggregates for string_agg and array_agg To: Tom Lane Cc: David Rowley , Stephen Frost , Andres Freund , PostgreSQL-development 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> <18741.1522245278@sss.pgh.pa.us> From: Tomas Vondra Message-ID: <1ffa699d-ff84-4c21-10cb-4d8b36017bab@2ndquadrant.com> Date: Wed, 28 Mar 2018 16:05:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <18741.1522245278@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 03/28/2018 03:54 PM, Tom Lane wrote: > 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. > Nope, David's patch does not check what the serial/deserial functions are (and checks aggref->aggargtypes directly, not the exprType thing). >> Also, if it's checking aggref->aggargtypes, it'll reject anyelement >> parameters, no? > > I had in mind to look at exprType() of the argument. > Right, I'm fine with that. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services