Re: OOM kill in xmlelement() with large arrays

From: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Kirill Reshke <reshkekirill(at)gmail(dot)com>
Subject: Re: OOM kill in xmlelement() with large arrays
Date: 2026-11-25 12:55:24
Message-ID: e91453a4-de77-4352-b6c8-315993bb1b36@uni-muenster.de
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 25/11/2026 12:50, Jim Jones wrote:
> psql (19.0 (Debian 19.0-2.pgdg13+1))
> Type "help" for help.
>
> postgres=# select length(xmlelement(name a, array_fill(''::text,
> ARRAY[56000000]))::text);
> server closed the connection unexpectedly
> This probably means the server terminated abnormally
> before or while processing the request.
> The connection to the server was lost. Attempting reset: Failed.
> The connection to the server was lost. Attempting reset: Failed.
> !?>
> \q

BTW the *_to_xml functions seem to share the same issue:

psql (19.0 (Debian 19.0-2.pgdg13+1))
Type "help" for help.

postgres=# select length(query_to_xml('SELECT g,g,g,g,g,g FROM
generate_series(1, 10000000) g', false, false, '')::text);
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
The connection to the server was lost. Attempting reset: Failed.
!?>

I'll take a look at them once we agree on the approach.

Best, Jim

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zhijie Hou 2026-11-25 13:00:33 Fix assert failure in composite type dependency check for index expr
Previous Message Anthony Sotolongo 2026-11-25 12:47:34 Re: passwordcheck: Make the user name check case-insensitive