Re: Error from array_agg when table has many rows

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Richard Guo <guofenglinux@gmail.com>
Cc: David Rowley <dgrowleyml@gmail.com>, Kirill Zdornyy <kirill@dineserve.com>, "pgsql-bugs@lists.postgresql.org" <pgsql-bugs@lists.postgresql.org>
Date: 2025-03-08T15:50:01Z
Lists: pgsql-bugs

Attachments

Richard Guo <guofenglinux@gmail.com> writes:
> We are performing deserialization during the final phase of the
> aggregation on data of type RECORD but we fail to provide a valid
> typmod (array_agg_deserialize() uses -1 as the typmod when calling the
> receiveproc).

> I haven't verified it, but I suspect it's related to 16fd03e95.

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.

			regards, tom lane

Commits

  1. Don't try to parallelize array_agg() on an anonymous record type.