mirror of
https://github.com/postgres/postgres.git
synced 2025-05-05 09:19:17 +03:00
Fix hash_array
Commit 054adca641ac1279dc8d9b74fda41948ac35e9a9 neglected to initialize the type_id field of the synthesized type cache entry, so it would make a new one on every call. Also, better use the per-function memory context for this; otherwise it leaks memory. Discussion: https://www.postgresql.org/message-id/flat/17158-8a2ba823982537a4%40postgresql.org
This commit is contained in:
parent
6e6adbddbc
commit
9b2fd49057
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user