pgsql: Report shared buffer exhaustion as insufficient resources

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Report shared buffer exhaustion as insufficient resources
Date: 2026-10-21 14:42:28
Message-ID: E1xJXWO-00000000CR8-2zHf@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)sraoss(dot)co(dot)jp>
Reviewed-by: Pierre Forstmann <pierre(dot)forstmann(at)gmail(dot)com>
Reviewed-by: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
Reviewed-by: solai v <solai(dot)cdac(at)gmail(dot)com>
Reviewed-by: Fujii Masao <masao(dot)fujii(at)gmail(dot)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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2026-10-21 15:53:10 pgsql: findtimezone: update Windows timezone name list for recent event
Previous Message Fujii Masao 2026-10-21 14:39:40 pgsql: doc: Correct psql's \d+x documentation for sequences