diff options
Diffstat (limited to 'src/backend/utils/adt/arrayfuncs.c')
-rw-r--r-- | src/backend/utils/adt/arrayfuncs.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/backend/utils/adt/arrayfuncs.c b/src/backend/utils/adt/arrayfuncs.c index bc2f30bae15..660e854e93f 100644 --- a/src/backend/utils/adt/arrayfuncs.c +++ b/src/backend/utils/adt/arrayfuncs.c @@ -3992,13 +3992,14 @@ hash_array(PG_FUNCTION_ARGS) MemoryContext oldcontext; TypeCacheEntry *record_typentry; - oldcontext = MemoryContextSwitchTo(CacheMemoryContext); + oldcontext = MemoryContextSwitchTo(fcinfo->flinfo->fn_mcxt); /* * Make fake type cache entry structure. Note that we can't just * modify typentry, since that points directly into the type cache. */ - record_typentry = palloc(sizeof(*record_typentry)); + record_typentry = palloc0(sizeof(*record_typentry)); + record_typentry->type_id = element_type; /* fill in what we need below */ record_typentry->typlen = typentry->typlen; |