pgsql: Improve generate_partition_qual()'s cache handling on out-of-mem

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Improve generate_partition_qual()'s cache handling on out-of-mem
Date: 2026-07-21 07:58:50
Message-ID: E1wm5NK-000000008c2-0T65@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)gmail(dot)com>
Author: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2026-07-21 13:43:18 pgsql: Message style fixes
Previous Message Peter Eisentraut 2026-07-21 06:50:05 pgsql: Test what BEFORE UPDATE triggers do to FOR PORTION OF