Content-Length: 275717 | pFad | http://github.com/postgrespro/postgres/commit/997066f4456c0fc582e62a50e296c77360212049

68 Fix two small bugs in json's populate_record_worker · postgrespro/postgres@997066f · GitHub
Skip to content

Commit 997066f

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 out of the function. The second bug is a logic error in choosing when to do an 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 parent 79edb29 commit 997066f

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
@@ -2099,6 +2099,7 @@ populate_record_worker(FunctionCallInfo fcinfo, const char *funcname,
20992099
if (hash_get_num_entries(json_hash) == 0 && rec)
21002100
{
21012101
hash_destroy(json_hash);
2102+
ReleaseTupleDesc(tupdesc);
21022103
PG_RETURN_POINTER(rec);
21032104
}
21042105
}
@@ -2107,8 +2108,11 @@ populate_record_worker(FunctionCallInfo fcinfo, const char *funcname,
21072108
jb = PG_GETARG_JSONB(json_arg_num);
21082109

21092110
/* same logic as for json */
2110-
if (!have_record_arg && rec)
2111+
if (JB_ROOT_COUNT(jb) == 0 && rec)
2112+
{
2113+
ReleaseTupleDesc(tupdesc);
21112114
PG_RETURN_POINTER(rec);
2115+
}
21122116
}
21132117

21142118
ncolumns = tupdesc->natts;

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/997066f4456c0fc582e62a50e296c77360212049

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy