Re: Error from array_agg when table has many rows

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Richard Guo <guofenglinux(at)gmail(dot)com>, Kirill Zdornyy <kirill(at)dineserve(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: Error from array_agg when table has many rows
Date: 2025-03-09 07:22:30
Message-ID: CAApHDvrsJ6qhgpjW2HNe8UbDkzZOdKQ=rDjeynswnce7LtWCxQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sun, 9 Mar 2025 at 04:50, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Richard Guo <guofenglinux(at)gmail(dot)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.

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.

David

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message 와따가따 2025-03-09 07:55:48 Is it possible for a WAL file to be missing records?
Previous Message David G. Johnston 2025-03-09 01:07:26 Re: Window Functions with identical PARTITION BY and ORDER BY clauses evaluated separately