Re: BUG #18484: "Cannot enlarge string buffer" during parallel execution of prepared statement/partitioning - Mailing list pgsql-bugs

From David Rowley
Subject Re: BUG #18484: "Cannot enlarge string buffer" during parallel execution of prepared statement/partitioning
Date
Msg-id CAApHDvo+sBc1836ktwVNesgPb7L9Bx1=p4OQpeieq8pg0nW-hg@mail.gmail.com
Whole thread Raw
In response to BUG #18484: "Cannot enlarge string buffer" during parallel execution of prepared statement/partitioning  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #18484: "Cannot enlarge string buffer" during parallel execution of prepared statement/partitioning
List pgsql-bugs
On Wed, 29 May 2024 at 04:42, PG Bug reporting form
<noreply@postgresql.org> wrote:
> ERROR:  out of memory
> DETAIL:  Cannot enlarge string buffer containing 1073741812 bytes by 32 more
> bytes.

> I agree that the overall schema architecture should be rethought and much
> fewer partitions be used (and they are looking into this), but as the error
> does only happen with a parallel plan, I am reporting it here in case there
> is an easy fix for this, or at least maybe we can abort earlier with a
> better error message?

I think we should at least write a better error message.  "out of
memory" is misleading. I've attached a patch with some proposed better
wording.

The above will become:
ERROR:  string buffer exceeds maximum allowed length (1073741823)
DETAIL:  Cannot enlarge string buffer containing 1073741812 bytes by 32 more

I also see a few other places that report
ERRCODE_PROGRAM_LIMIT_EXCEEDED and display "out of memory". Namely:

pg_do_encoding_conversion
perform_default_encoding_conversion
pvsnprintf

We should probably consider fixing those too.

I understand this isn't to the level that you'd like to see this
fixed, but it at least should stop people from thinking that
installing more RAM might help.

David

Attachment

pgsql-bugs by date:

Previous
From: Marcin Barczyński
Date:
Subject: Re: BUG #18334: Segfault when running a query with parallel workers
Next
From: Daniel Gustafsson
Date:
Subject: Re: BUG #18484: "Cannot enlarge string buffer" during parallel execution of prepared statement/partitioning