diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2014-03-26 10:18:24 -0400 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2014-03-26 10:18:24 -0400 |
commit | f9c6d72cbf49257fea4265d994b96e66f25b2474 (patch) | |
tree | cb6117cc88855a54d382bbeae26303ee9a24af0b /src/backend/utils/adt/jsonfuncs.c | |
parent | 28475f8e58bd5da2b44a42203665a543f335c6a3 (diff) | |
download | postgresql-f9c6d72cbf49257fea4265d994b96e66f25b2474.tar.gz postgresql-f9c6d72cbf49257fea4265d994b96e66f25b2474.zip |
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).
Diffstat (limited to 'src/backend/utils/adt/jsonfuncs.c')
-rw-r--r-- | src/backend/utils/adt/jsonfuncs.c | 36 |
1 files changed, 24 insertions, 12 deletions
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 @@ -2015,6 +2015,12 @@ jsonb_populate_record(PG_FUNCTION_ARGS) } Datum +jsonb_to_record(PG_FUNCTION_ARGS) +{ + return populate_record_worker(fcinfo, false); +} + +Datum json_populate_record(PG_FUNCTION_ARGS) { return populate_record_worker(fcinfo, true); @@ -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() */ |