aboutsummaryrefslogtreecommitdiff
path: root/src/include/utils/json.h
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2014-01-28 17:48:21 -0500
committerAndrew Dunstan <andrew@dunslane.net>2014-01-28 17:48:21 -0500
commit105639900bf83fd3e3eb5b49f49b4d74d6347b9b (patch)
tree8bd01cee2f01995284b709d1800c6144045675f8 /src/include/utils/json.h
parent9132b189bf5589591cb63fef7952842b772e4fe6 (diff)
downloadpostgresql-105639900bf83fd3e3eb5b49f49b4d74d6347b9b.tar.gz
postgresql-105639900bf83fd3e3eb5b49f49b4d74d6347b9b.zip
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.
Diffstat (limited to 'src/include/utils/json.h')
-rw-r--r--src/include/utils/json.h13
1 files changed, 13 insertions, 0 deletions
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 */