diff options
Diffstat (limited to 'src/backend/utils/cache/ts_cache.c')
-rw-r--r-- | src/backend/utils/cache/ts_cache.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/backend/utils/cache/ts_cache.c b/src/backend/utils/cache/ts_cache.c index 3d5c1941488..97347780d3b 100644 --- a/src/backend/utils/cache/ts_cache.c +++ b/src/backend/utils/cache/ts_cache.c @@ -294,16 +294,19 @@ lookup_ts_dictionary_cache(Oid dictId) Assert(!found); /* it wasn't there a moment ago */ /* Create private memory context the first time through */ - saveCtx = AllocSetContextCreateExtended(CacheMemoryContext, - NameStr(dict->dictname), - MEMCONTEXT_COPY_NAME, - ALLOCSET_SMALL_SIZES); + saveCtx = AllocSetContextCreate(CacheMemoryContext, + "TS dictionary", + ALLOCSET_SMALL_SIZES); + MemoryContextCopySetIdentifier(saveCtx, NameStr(dict->dictname)); } else { /* Clear the existing entry's private context */ saveCtx = entry->dictCtx; - MemoryContextResetAndDeleteChildren(saveCtx); + /* Don't let context's ident pointer dangle while we reset it */ + MemoryContextSetIdentifier(saveCtx, NULL); + MemoryContextReset(saveCtx); + MemoryContextCopySetIdentifier(saveCtx, NameStr(dict->dictname)); } MemSet(entry, 0, sizeof(TSDictionaryCacheEntry)); |