aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/jsonfuncs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/adt/jsonfuncs.c')
-rw-r--r--src/backend/utils/adt/jsonfuncs.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/backend/utils/adt/jsonfuncs.c b/src/backend/utils/adt/jsonfuncs.c
index 274f64c95f8..5f61cfcb73a 100644
--- a/src/backend/utils/adt/jsonfuncs.c
+++ b/src/backend/utils/adt/jsonfuncs.c
@@ -2115,6 +2115,7 @@ populate_record_worker(FunctionCallInfo fcinfo, const char *funcname,
if (hash_get_num_entries(json_hash) == 0 && rec)
{
hash_destroy(json_hash);
+ ReleaseTupleDesc(tupdesc);
PG_RETURN_POINTER(rec);
}
}
@@ -2123,8 +2124,11 @@ populate_record_worker(FunctionCallInfo fcinfo, const char *funcname,
jb = PG_GETARG_JSONB(json_arg_num);
/* same logic as for json */
- if (!have_record_arg && rec)
+ if (JB_ROOT_COUNT(jb) == 0 && rec)
+ {
+ ReleaseTupleDesc(tupdesc);
PG_RETURN_POINTER(rec);
+ }
}
ncolumns = tupdesc->natts;