pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <fujii@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Report shared buffer exhaustion as insufficient resources
Date: Wed, 21 Oct 2026 14:42:28 +0000
Message-ID: <E1xJXWO-00000000CR8-2zHf@gemulon.postgresql.org> (raw)

Report shared buffer exhaustion as insufficient resources

When all shared buffers examined are pinned, a query can fail with
"no unpinned buffers available". This can happen when shared_buffers
is too small for the workload, but the error was reported as an internal
error, making a resource shortage look like a server bug.

Replace elog() with ereport() to report this condition with SQLSTATE
53000 (insufficient_resources) instead of XX000 (internal_error),
matching the corresponding local-buffer error. Reword both messages
to clarify whether shared or local buffers are involved.

Author: Ma Xueting <ma@sraoss.co.jp>
Reviewed-by: Pierre Forstmann <pierre.forstmann@gmail.com>
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>
Reviewed-by: solai v <solai.cdac@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/TYWP286MB2571C92032EE9D1B8F2BFACFEF812@TYWP286MB2571.JPNP286.PROD.OUTLOOK.COM

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4b97fd15fb497d2810a29cd30bfacd89400b596c

Modified Files
--------------
src/backend/storage/buffer/freelist.c | 4 +++-
src/backend/storage/buffer/localbuf.c | 2 +-
src/test/regress/expected/temp.out    | 4 ++--
3 files changed, 6 insertions(+), 4 deletions(-)



Message-ID: <E1xJXWO-00000000CR8-2zHf@gemulon.postgresql.org>
Permalink:  ../E1xJXWO-00000000CR8-2zHf@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xJXWO-00000000CR8-2zHf@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: fujii@postgresql.org
  Subject: Re: pgsql: Report shared buffer exhaustion as insufficient resources
  In-Reply-To: <E1xJXWO-00000000CR8-2zHf@gemulon.postgresql.org>
  References: <E1xJXWO-00000000CR8-2zHf@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