pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: lukas.eder@gmail.com
Subject: BUG #19063: Heavily nesting trivial ROW projections produces out of memory error
Date: Wed, 24 Sep 2025 14:06:07 +0000
Message-ID: <19063-c1ba39b11b9d43b7@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      19063
Logged by:          Lukas Eder
Email address:      lukas.eder@gmail.com
PostgreSQL version: 18rc1
Operating system:   Linux in Docker in Windows
Description:        

Try this query:

select
  row (row (row (row (row (row (row (row (
  row (row (row (row (row (row (row (row (
  row (row (row (row (row (row (row (row (
  row (row (row (row (row (row (row (row (
    1
  ))))))))
  ))))))))
  ))))))))
  )))))))) as "nested";

It produces the following error:

SQL Error [54000]: ERROR: string buffer exceeds maximum allowed length
(1073741823 bytes)
  Detail: Cannot enlarge string buffer containing 1073741822 bytes by 1 more
bytes.

I don't understand how such excessive memory consumption is produced by such
a "simple" query. The nesting is a bit excessive, sure, but I think there's
a deeper underlying inefficiency that might be worth addressing.

I've tried both these versions:

- PostgreSQL 17.5 (Debian 17.5-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled
by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
- PostgreSQL 18rc1 (Debian 18~rc1-1.pgdg13+1) on x86_64-pc-linux-gnu,
compiled by gcc (Debian 14.2.0-19) 14.2.0, 64-bit



view thread (3+ messages)  latest in thread

Message-ID: <19063-c1ba39b11b9d43b7@postgresql.org>
Permalink:  ../19063-c1ba39b11b9d43b7@postgresql.org/
Also on:    postgresql.org/message-id/19063-c1ba39b11b9d43b7@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-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, lukas.eder@gmail.com
  Subject: Re: BUG #19063: Heavily nesting trivial ROW projections produces out of memory error
  In-Reply-To: <19063-c1ba39b11b9d43b7@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