From 105639900bf83fd3e3eb5b49f49b4d74d6347b9b Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Tue, 28 Jan 2014 17:48:21 -0500 Subject: New json functions. json_build_array() and json_build_object allow for the construction of arbitrarily complex json trees. json_object() turns a one or two dimensional array, or two separate arrays, into a json_object of name/value pairs, similarly to the hstore() function. json_object_agg() aggregates its two arguments into a single json object as name value pairs. Catalog version bumped. Andrew Dunstan, reviewed by Marko Tiikkaja. --- src/include/utils/json.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/include/utils/json.h') diff --git a/src/include/utils/json.h b/src/include/utils/json.h index 25bfafb7914..ed96a62f635 100644 --- a/src/include/utils/json.h +++ b/src/include/utils/json.h @@ -31,6 +31,17 @@ extern Datum to_json(PG_FUNCTION_ARGS); extern Datum json_agg_transfn(PG_FUNCTION_ARGS); extern Datum json_agg_finalfn(PG_FUNCTION_ARGS); +extern Datum json_object_agg_finalfn(PG_FUNCTION_ARGS); +extern Datum json_object_agg_transfn(PG_FUNCTION_ARGS); + +extern Datum json_build_object(PG_FUNCTION_ARGS); +extern Datum json_build_object_noargs(PG_FUNCTION_ARGS); +extern Datum json_build_array(PG_FUNCTION_ARGS); +extern Datum json_build_array_noargs(PG_FUNCTION_ARGS); + +extern Datum json_object(PG_FUNCTION_ARGS); +extern Datum json_object_two_arg(PG_FUNCTION_ARGS); + extern void escape_json(StringInfo buf, const char *str); extern Datum json_typeof(PG_FUNCTION_ARGS); @@ -49,5 +60,7 @@ extern Datum json_each_text(PG_FUNCTION_ARGS); extern Datum json_array_elements(PG_FUNCTION_ARGS); extern Datum json_populate_record(PG_FUNCTION_ARGS); extern Datum json_populate_recordset(PG_FUNCTION_ARGS); +extern Datum json_to_record(PG_FUNCTION_ARGS); +extern Datum json_to_recordset(PG_FUNCTION_ARGS); #endif /* JSON_H */ -- cgit v1.2.3