pgsql: Make FastPathMeta self-contained by copying FmgrInfo structs

From: Amit Langote <amitlan(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Make FastPathMeta self-contained by copying FmgrInfo structs
Date: 2026-04-01 09:48:04
Message-ID: E1w7sB9-002RNA-1Z@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Make FastPathMeta self-contained by copying FmgrInfo structs

FastPathMeta stored pointers into ri_compare_cache entries via
compare_entries[], creating a dependency on that cache remaining
stable. If ri_compare_cache entries were invalidated after fpmeta
was populated, the pointers would dangle.

Replace compare_entries[] with inline copies of the two FmgrInfo
fields actually needed (cast_func_finfo and eq_opr_finfo), copied
at populate time via fmgr_info_copy(). fpmeta now depends only on
riinfo remaining valid, which is already handled by the invalidation
callback.

Introduced by commit 2da86c1ef9 ("Add fast path for foreign key
constraint checks"), noticed while reviewing code for robustness
under CLOBBER_CACHE_ALWAYS.

Discussion: https://postgr.es/m/CA+HiwqFQ+ZA7hSOygv4uv_t75B3r0_gosjadetCsAEoaZwTu6g@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/utils/adt/ri_triggers.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2026-04-01 13:27:15 pgsql: aio: io_uring: Allow IO methods to check if IO completed in the
Previous Message Amit Langote 2026-04-01 08:52:32 Re: pgsql: Add fast path for foreign key constraint checks