diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2012-02-03 12:11:16 -0500 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2012-02-03 12:11:16 -0500 |
commit | 39909d1d39ae57c3a655fc7010e394e26b90fec9 (patch) | |
tree | 7eff6f5605be63418574a53b085ed1fd420cd223 /src/include | |
parent | 69e9768e7b183d4b276d0e067a5a0000689580eb (diff) | |
download | postgresql-39909d1d39ae57c3a655fc7010e394e26b90fec9.tar.gz postgresql-39909d1d39ae57c3a655fc7010e394e26b90fec9.zip |
Add array_to_json and row_to_json functions.
Also move the escape_json function from explain.c to json.c where it
seems to belong.
Andrew Dunstan, Reviewd by Abhijit Menon-Sen.
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/catalog/pg_proc.h | 8 | ||||
-rw-r--r-- | src/include/utils/json.h | 5 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index 5dc6d05478f..8fc4ddb4b56 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -4031,6 +4031,14 @@ DATA(insert OID = 323 ( json_recv PGNSP PGUID 12 1 0 0 0 f f f t f s 1 0 11 DESCR("I/O"); DATA(insert OID = 324 ( json_send PGNSP PGUID 12 1 0 0 0 f f f t f s 1 0 17 "114" _null_ _null_ _null_ _null_ json_send _null_ _null_ _null_ )); DESCR("I/O"); +DATA(insert OID = 3153 ( array_to_json PGNSP PGUID 12 1 0 0 0 f f f t f s 1 0 114 "2277" _null_ _null_ _null_ _null_ array_to_json _null_ _null_ _null_ )); +DESCR("map array to json"); +DATA(insert OID = 3154 ( array_to_json PGNSP PGUID 12 1 0 0 0 f f f t f s 2 0 114 "2277 16" _null_ _null_ _null_ _null_ array_to_json_pretty _null_ _null_ _null_ )); +DESCR("map array to json with optional pretty printing"); +DATA(insert OID = 3155 ( row_to_json PGNSP PGUID 12 1 0 0 0 f f f t f s 1 0 114 "2249" _null_ _null_ _null_ _null_ row_to_json _null_ _null_ _null_ )); +DESCR("map row to json"); +DATA(insert OID = 3156 ( row_to_json PGNSP PGUID 12 1 0 0 0 f f f t f s 2 0 114 "2249 16" _null_ _null_ _null_ _null_ row_to_json_pretty _null_ _null_ _null_ )); +DESCR("map row to json with optional pretty printing"); /* uuid */ DATA(insert OID = 2952 ( uuid_in PGNSP PGUID 12 1 0 0 0 f f f t f i 1 0 2950 "2275" _null_ _null_ _null_ _null_ uuid_in _null_ _null_ _null_ )); diff --git a/src/include/utils/json.h b/src/include/utils/json.h index ee87fd61d7c..415787b458d 100644 --- a/src/include/utils/json.h +++ b/src/include/utils/json.h @@ -20,5 +20,10 @@ extern Datum json_in(PG_FUNCTION_ARGS); extern Datum json_out(PG_FUNCTION_ARGS); extern Datum json_recv(PG_FUNCTION_ARGS); extern Datum json_send(PG_FUNCTION_ARGS); +extern Datum array_to_json(PG_FUNCTION_ARGS); +extern Datum array_to_json_pretty(PG_FUNCTION_ARGS); +extern Datum row_to_json(PG_FUNCTION_ARGS); +extern Datum row_to_json_pretty(PG_FUNCTION_ARGS); +extern void escape_json(StringInfo buf, const char *str); #endif /* XML_H */ |