pgsql: Always acquire expanded record descriptors early

From: Noah Misch <noah(at)leadboat(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Always acquire expanded record descriptors early
Date: 2026-11-09 14:21:56
Message-ID: E1xQQFw-000000003Ya-1svE@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Always acquire expanded record descriptors early

Only make_expanded_record_from_datum() deferred tuple descriptor lookup,
and it has no direct/indirect users in core nor in known open source
extensions (checked via pgxn and github). The other ERH constructors
already acquire a descriptor eagerly.

The main reason for this change is that subsequent commits are
simplified by it.

This also allows implementing the datum constructor using
make_expanded_record_from_typeid(), removing a good bit of duplicated
code.

This preserves ABI compatibility, to allow for backpatching.

Reviewed-by: Tomas Vondra <tomas(at)vondra(dot)me>
Reviewed-by: Melanie Plageman <melanieplageman(at)gmail(dot)com>
Security: CVE-2026-6460
Backpatch-through: 14

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4b7a4c2c9e62e94737d0175e5a05173a58d2264e
Author: Andres Freund <andres(at)anarazel(dot)de>

Modified Files
--------------
src/backend/utils/adt/expandedrecord.c | 158 ++++-----------------------
src/include/utils/expandedrecord.h | 15 +--
src/test/regress/expected/rowtypes_alter.out | 2 +-
3 files changed, 27 insertions(+), 148 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Noah Misch 2026-11-09 14:21:57 pgsql: Fix reusing large allocations in generation memory contexts
Previous Message Noah Misch 2026-11-09 14:21:55 pgsql: Fix type confusion with materialized set-returning functions