pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Improve error message for MaxAllocSize overrun in accumArrayResu
Date: Fri, 14 Jul 2023 14:38:30 +0000
Message-ID: <E1qKJwE-000LIU-8h@gemulon.postgresql.org> (raw)

Improve error message for MaxAllocSize overrun in accumArrayResult.

Before, if you went past about 64M array elements in array_agg() and
allied functions, you got a generic "invalid memory alloc request
size" error.  This patch replaces that with "array size exceeds the
maximum allowed", which seems more user-friendly since it points you
to needing to reduce the size of your array result.  (This is the
same error text you'd get from construct_md_array in the event of
overrunning the maximum physical size for the finished array.)

Per question from Shaozhong Shi.  Since this hasn't come up often,
I don't feel a need to back-patch.

Discussion: https://postgr.es/m/CA+i5JwYtVS9z2E71PcNKAVPbOn4R2wuj-LqbJsYr_XOz73q7dQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b8d3dae00f6c49d0c41abd5b36e2588a81abe5be

Modified Files
--------------
src/backend/utils/adt/arrayfuncs.c | 6 ++++++
1 file changed, 6 insertions(+)



Message-ID: <E1qKJwE-000LIU-8h@gemulon.postgresql.org>
Permalink:  ../E1qKJwE-000LIU-8h@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qKJwE-000LIU-8h@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Improve error message for MaxAllocSize overrun in accumArrayResu
  In-Reply-To: <E1qKJwE-000LIU-8h@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox