Re: v16dev: invalid memory alloc request size 8488348128

David Rowley <dgrowleyml@gmail.com>

From: David Rowley <dgrowleyml@gmail.com>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: pgsql-hackers@postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>
Date: 2023-04-14T22:04:52Z
Lists: pgsql-hackers
On Sat, 15 Apr 2023 at 08:36, Justin Pryzby <pryzby@telsasoft.com> wrote:
>
> I hit this elog() while testing reports under v16 and changed to PANIC
> to help diagnose.
>
> DETAILS: PANIC:  invalid memory alloc request size 18446744072967930808
> CONTEXT:  PL/pgSQL function array_weight(real[],real[]) while storing call arguments into local variables
>
> I can't share the query, data, nor plpgsql functions themselves.

Which aggregate function is being called here?  Is it a custom
aggregate written in C, by any chance?

David



Commits

  1. Ensure result of an aggregate's finalfunc is made read-only.

  2. Remove uses of MemoryContextContains in nodeAgg.c and nodeWindowAgg.c.

  3. Fix pg_upgrade to detect non-upgradable anyarray usages.

  4. Work around cross-version-upgrade issues created by commit 9e38c2bb5.

  5. Declare assorted array functions using anycompatible not anyelement.