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

Commit3c000fd

Browse files
committed
Fix two small bugs in json's populate_record_worker
The first bug is not releasing a tupdesc when doing an early return outof the function. The second bug is a logic error in choosing when to doan early return if given an empty jsonb object.Bug reports from Pavel Stehule and Tom Lane respectively.Backpatch to 9.4 where these were introduced.
1 parentc90b85e commit3c000fd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2115,6 +2115,7 @@ populate_record_worker(FunctionCallInfo fcinfo, const char *funcname,
21152115
if (hash_get_num_entries(json_hash)==0&&rec)
21162116
{
21172117
hash_destroy(json_hash);
2118+
ReleaseTupleDesc(tupdesc);
21182119
PG_RETURN_POINTER(rec);
21192120
}
21202121
}
@@ -2123,8 +2124,11 @@ populate_record_worker(FunctionCallInfo fcinfo, const char *funcname,
21232124
jb=PG_GETARG_JSONB(json_arg_num);
21242125

21252126
/* same logic as for json */
2126-
if (!have_record_arg&&rec)
2127+
if (JB_ROOT_COUNT(jb)==0&&rec)
2128+
{
2129+
ReleaseTupleDesc(tupdesc);
21272130
PG_RETURN_POINTER(rec);
2131+
}
21282132
}
21292133

21302134
ncolumns=tupdesc->natts;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp