pgsql: New json functions.

Started by Andrew Dunstanover 12 years ago4 messagescomitters
Jump to latest
#1Andrew Dunstan
andrew@dunslane.net

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.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/105639900bf83fd3e3eb5b49f49b4d74d6347b9b

Modified Files
--------------
doc/src/sgml/func.sgml | 158 ++++++++++
src/backend/utils/adt/json.c | 577 ++++++++++++++++++++++++++++++++--
src/backend/utils/adt/jsonfuncs.c | 176 ++++++++---
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_aggregate.h | 1 +
src/include/catalog/pg_proc.h | 22 ++
src/include/utils/json.h | 13 +
src/test/regress/expected/json.out | 126 ++++++++
src/test/regress/expected/json_1.out | 126 ++++++++
src/test/regress/sql/json.sql | 87 +++++
10 files changed, 1219 insertions(+), 69 deletions(-)

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#2Andrew Dunstan
andrew@dunslane.net
In reply to: Andrew Dunstan (#1)
Re: pgsql: New json functions.

*sigh* forgot to mention that json_to_record() is also included. It
turns a json
argument into whatever record type is expected by the call.

On 01/28/2014 05:55 PM, Andrew Dunstan wrote:

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.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/105639900bf83fd3e3eb5b49f49b4d74d6347b9b

Modified Files
--------------
doc/src/sgml/func.sgml | 158 ++++++++++
src/backend/utils/adt/json.c | 577 ++++++++++++++++++++++++++++++++--
src/backend/utils/adt/jsonfuncs.c | 176 ++++++++---
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_aggregate.h | 1 +
src/include/catalog/pg_proc.h | 22 ++
src/include/utils/json.h | 13 +
src/test/regress/expected/json.out | 126 ++++++++
src/test/regress/expected/json_1.out | 126 ++++++++
src/test/regress/sql/json.sql | 87 +++++
10 files changed, 1219 insertions(+), 69 deletions(-)

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#3Thom Brown
thom@linux.com
In reply to: Andrew Dunstan (#1)
Re: pgsql: New json functions.

On 28 January 2014 22:55, Andrew Dunstan <andrew@dunslane.net> wrote:

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.

A typo:

s/agument/argument/

Also, these are changes that probably aren't essential, but makes some
sentences clearer:

s/heterogeneously typed/heterogeneously-typed/

s/two argument form/two-argument form/

s/one argument form/one-argument form/

s/type coercion/type-coercion/

--
Thom

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#4Andrew Dunstan
andrew@dunslane.net
In reply to: Thom Brown (#3)
Re: pgsql: New json functions.

On 01/28/2014 06:14 PM, Thom Brown wrote:

On 28 January 2014 22:55, Andrew Dunstan <andrew@dunslane.net> wrote:

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.

A typo:

s/agument/argument/

Also, these are changes that probably aren't essential, but makes some
sentences clearer:

s/heterogeneously typed/heterogeneously-typed/

s/two argument form/two-argument form/

s/one argument form/one-argument form/

s/type coercion/type-coercion/

Thanks, will fix.

cheers

andrew

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers