pgsql: Maintain RelIdToTypeIdCacheHash in TypeCacheOpcCallback()

From: Alexander Korotkov <akorotkov(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Maintain RelIdToTypeIdCacheHash in TypeCacheOpcCallback()
Date: 2025-04-23 17:27:39
Message-ID: E1u7dsp-001RGh-1o@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Maintain RelIdToTypeIdCacheHash in TypeCacheOpcCallback()

b85a9d046efd introduced a new RelIdToTypeIdCacheHash, whose entries should
exist for typecache entries with TCFLAGS_HAVE_PG_TYPE_DATA flag set or any
of TCFLAGS_OPERATOR_FLAGS set or tupDesc set. However, TypeCacheOpcCallback(),
which resets TCFLAGS_OPERATOR_FLAGS, was forgotten to update
RelIdToTypeIdCacheHash.

This commit adds a delete_rel_type_cache_if_needed() call to the
TypeCacheOpcCallback() function to maintain RelIdToTypeIdCacheHash after
resetting TCFLAGS_OPERATOR_FLAGS.

Also, this commit fixes the name of the delete_rel_type_cache_if_needed()
function in its mentions in the comments.

Reported-by: Noah Misch
Discussion: https://postgr.es/m/20250411203241.e9.nmisch%40google.com

Branch
------
master

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

Modified Files
--------------
src/backend/utils/cache/typcache.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2025-04-23 18:14:34 Re: pgsql: Add function to get memory context stats for processes
Previous Message Robert Haas 2025-04-23 16:12:11 Re: pgsql: Add function to get memory context stats for processes