Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1trKF4-002ASE-Vn for pgsql-bugs@arkaria.postgresql.org; Sun, 09 Mar 2025 17:15:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1trKF3-00Acqf-Nm for pgsql-bugs@arkaria.postgresql.org; Sun, 09 Mar 2025 17:15:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1trKF3-00AcqP-Ex for pgsql-bugs@lists.postgresql.org; Sun, 09 Mar 2025 17:15:09 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1trKF0-001spB-00 for pgsql-bugs@lists.postgresql.org; Sun, 09 Mar 2025 17:15:09 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 529HErWQ397018; Sun, 9 Mar 2025 13:14:53 -0400 From: Tom Lane To: David Rowley cc: Richard Guo , Kirill Zdornyy , "pgsql-bugs@lists.postgresql.org" Subject: Re: Error from array_agg when table has many rows In-reply-to: References: <1297401.1741449001@sss.pgh.pa.us> Comments: In-reply-to David Rowley message dated "Sun, 09 Mar 2025 20:22:30 +1300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <397016.1741540493.1@sss.pgh.pa.us> Date: Sun, 09 Mar 2025 13:14:53 -0400 Message-ID: <397017.1741540493@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk David Rowley writes: > On Sun, 9 Mar 2025 at 04:50, Tom Lane wrote: >> Yeah. I don't think there is any way for array_agg_deserialize to >> know the correct typmod, so what we have to do is disable using >> partial aggregation in this case. Fortunately there's a >> policy-setting function that can be taught that, as attached. > The only way I can think of to get that would be to special-case > array_agg_serialize() to have it serialize the typmod when the send > function is record_send(), then add a similar special-case to > array_agg_deserialize() to check for a record_recv() and deserialize > the typmod there. That doesn't seem very pretty, so I'm happy to go > with your fix to disable parallel aggregates for this case. Yeah ... we could probably make that work if we had to, but the ugliness would likely metastasize outside array_agg_[de]serialize. Since it took more than a year to get a field report, I'm content to just disable the optimization instead. Pushed that way. regards, tom lane