From f9c6d72cbf49257fea4265d994b96e66f25b2474 Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Wed, 26 Mar 2014 10:18:24 -0400 Subject: Cleanup around json_to_record/json_to_recordset Set function parameter names and defaults. Add jsonb versions (which the code already provided for so the actual new code is trivial). Add jsonb regression tests and docs. Bump catalog version (which I apparently forgot to do when jsonb was committed). --- src/backend/utils/adt/jsonfuncs.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) (limited to 'src/backend/utils/adt/jsonfuncs.c') diff --git a/src/backend/utils/adt/jsonfuncs.c b/src/backend/utils/adt/jsonfuncs.c index 94595998029..bf164677142 100644 --- a/src/backend/utils/adt/jsonfuncs.c +++ b/src/backend/utils/adt/jsonfuncs.c @@ -2014,6 +2014,12 @@ jsonb_populate_record(PG_FUNCTION_ARGS) return populate_record_worker(fcinfo, true); } +Datum +jsonb_to_record(PG_FUNCTION_ARGS) +{ + return populate_record_worker(fcinfo, false); +} + Datum json_populate_record(PG_FUNCTION_ARGS) { @@ -2449,6 +2455,24 @@ jsonb_populate_recordset(PG_FUNCTION_ARGS) return populate_recordset_worker(fcinfo, true); } +Datum +jsonb_to_recordset(PG_FUNCTION_ARGS) +{ + return populate_recordset_worker(fcinfo, false); +} + +Datum +json_populate_recordset(PG_FUNCTION_ARGS) +{ + return populate_recordset_worker(fcinfo, true); +} + +Datum +json_to_recordset(PG_FUNCTION_ARGS) +{ + return populate_recordset_worker(fcinfo, false); +} + static void make_row_from_rec_and_jsonb(Jsonb * element, PopulateRecordsetState *state) { @@ -2571,18 +2595,6 @@ make_row_from_rec_and_jsonb(Jsonb * element, PopulateRecordsetState *state) tuplestore_puttuple(state->tuple_store, rettuple); } -Datum -json_populate_recordset(PG_FUNCTION_ARGS) -{ - return populate_recordset_worker(fcinfo, true); -} - -Datum -json_to_recordset(PG_FUNCTION_ARGS) -{ - return populate_recordset_worker(fcinfo, false); -} - /* * common worker for json_populate_recordset() and json_to_recordset() */ -- cgit v1.2.3