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_gosjadetcsaeoazwt...@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(-)

Reply via email to