Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit851ff93

Browse files
committed
Fix hash_array
Commita3d2b1b neglected toinitialize the type_id field of the synthesized type cache entry, soit would make a new one on every call.Also, better use the per-function memory context for this; otherwiseit leaks memory.Discussion:https://www.postgresql.org/message-id/flat/17158-8a2ba823982537a4%40postgresql.org
1 parent379591f commit851ff93

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

‎src/backend/utils/adt/arrayfuncs.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3992,13 +3992,14 @@ hash_array(PG_FUNCTION_ARGS)
39923992
MemoryContextoldcontext;
39933993
TypeCacheEntry*record_typentry;
39943994

3995-
oldcontext=MemoryContextSwitchTo(CacheMemoryContext);
3995+
oldcontext=MemoryContextSwitchTo(fcinfo->flinfo->fn_mcxt);
39963996

39973997
/*
39983998
* Make fake type cache entry structure. Note that we can't just
39993999
* modify typentry, since that points directly into the type cache.
40004000
*/
4001-
record_typentry=palloc(sizeof(*record_typentry));
4001+
record_typentry=palloc0(sizeof(*record_typentry));
4002+
record_typentry->type_id=element_type;
40024003

40034004
/* fill in what we need below */
40044005
record_typentry->typlen=typentry->typlen;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp