pgsql: CheckNNConstraintFetch: Fill all of ConstrCheck in a single pass

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: CheckNNConstraintFetch: Fill all of ConstrCheck in a single pass
Date: 2025-10-29 10:49:26
Message-ID: E1vE3k6-0044CA-0p@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

CheckNNConstraintFetch: Fill all of ConstrCheck in a single pass

Previously, we'd fill all fields except ccbin, and only later obtain and
detoast ccbin, with hypothetical failures being possible. If ccbin is
null (rare catalog corruption I have never witnessed) or its a corrupted
toast entry, we leak a tiny bit of memory in CacheMemoryContext from
having strdup'd the constraint name. Repair these by only attempting to
fill the struct once ccbin has been detoasted.

Author: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAEudQAr=i3_Z4GvmediX900+sSySTeMkvuytYShhQqEwoGyvhA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/94f95d91b025cb6752b4118bb0b30851e3d64df9

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

Browse pgsql-committers by date

  From Date Subject
Next Message Álvaro Herrera 2025-10-29 11:35:48 pgsql: pg_stat_statements: Fix handling of duplicate constant locations
Previous Message Peter Eisentraut 2025-10-29 09:01:48 pgsql: Reorganize GUC structs