aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/utils/cache/typcache.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/backend/utils/cache/typcache.c b/src/backend/utils/cache/typcache.c
index afbe121f7af..5fd02958cf1 100644
--- a/src/backend/utils/cache/typcache.c
+++ b/src/backend/utils/cache/typcache.c
@@ -578,6 +578,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);
@@ -601,6 +604,8 @@ cache_record_field_properties(TypeCacheEntry *typentry)
break;
}
typentry->flags |= newflags;
+
+ DecrTupleDescRefCount(tupdesc);
}
typentry->flags |= TCFLAGS_CHECKED_FIELD_PROPERTIES;
}