agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Improve generate_partition_qual()'s cache handling on out-of-mem
Date: Tue, 21 Jul 2026 07:58:50 +0000
Message-ID: <E1wm5NK-000000008c2-0T65@gemulon.postgresql.org> (raw)

Improve generate_partition_qual()'s cache handling on out-of-memory errors

An in-flight failure when trying to set rd_partcheckcxt or
rd_partcheck, while for example doing an allocation in copyObject(),
would leave a backend cache in a corrupted state.  The operations are
now ordered so as we avoid a leak in the cache memory context and a
semi-filled cache state when an allocation failure happens.

This is unlikely going to be hit in practice.  Like the other
improvements of this kind, no backpatch is done.

Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: Matthias van de Meent <boekewurm+postgres@gmail.com>
Discussion: https://postgr.es/m/95c64dc2-3abe-4f4e-b285-4c681f565d9f@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/fc6425fbe7a1fc7458fc27060ec78c5d98757690

Modified Files
--------------
src/backend/utils/cache/partcache.c | 29 +++++++++++++++++++++++------
1 file changed, 23 insertions(+), 6 deletions(-)



Message-ID: <E1wm5NK-000000008c2-0T65@gemulon.postgresql.org>
Permalink:  ../E1wm5NK-000000008c2-0T65@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wm5NK-000000008c2-0T65@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Improve generate_partition_qual()'s cache handling on out-of-mem
  In-Reply-To: <E1wm5NK-000000008c2-0T65@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox