diff options
-rw-r--r-- | src/backend/utils/cache/typcache.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/backend/utils/cache/typcache.c b/src/backend/utils/cache/typcache.c index 5155a14342f..2fa6d335350 100644 --- a/src/backend/utils/cache/typcache.c +++ b/src/backend/utils/cache/typcache.c @@ -648,6 +648,9 @@ cache_record_field_properties(TypeCacheEntry *typentry) load_typcache_tupdesc(typentry); tupdesc = typentry->tupDesc; + /* Must bump the refcount while we do additional catalog lookups */ + IncrTupleDescRefCount(tupdesc); + /* Have each property if all non-dropped fields have the property */ newflags = (TCFLAGS_HAVE_FIELD_EQUALITY | TCFLAGS_HAVE_FIELD_COMPARE); @@ -671,6 +674,8 @@ cache_record_field_properties(TypeCacheEntry *typentry) break; } typentry->flags |= newflags; + + DecrTupleDescRefCount(tupdesc); } typentry->flags |= TCFLAGS_CHECKED_FIELD_PROPERTIES; } |