1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-03 20:02:46 +03:00

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).
This commit is contained in:
Andrew Dunstan
2014-03-26 10:18:24 -04:00
parent 28475f8e58
commit f9c6d72cbf
9 changed files with 99 additions and 19 deletions

View File

@ -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()
*/