pgsql: JSON generation improvements.

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: JSON generation improvements.
Date: 2013-03-10 21:36:07
Message-ID: E1UEnuZ-0000qG-R8@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

JSON generation improvements.

This adds the following:

json_agg(anyrecord) -> json
to_json(any) -> json
hstore_to_json(hstore) -> json (also used as a cast)
hstore_to_json_loose(hstore) -> json

The last provides heuristic treatment of numbers and booleans.

Also, in json generation, if any non-builtin type has a cast to json,
that function is used instead of the type's output function.

Andrew Dunstan, reviewed by Steve Singer.

Catalog version bumped.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/38fb4d978c5bfc377ef979e2595e3472744a3b05

Modified Files
--------------
contrib/hstore/expected/hstore.out | 36 ++++
contrib/hstore/hstore--1.1.sql | 13 ++
contrib/hstore/hstore_io.c | 217 ++++++++++++++++++++++++
contrib/hstore/sql/hstore.sql | 12 ++
doc/src/sgml/func.sgml | 48 ++++++
doc/src/sgml/hstore.sgml | 23 +++
src/backend/utils/adt/json.c | 317 +++++++++++++++++++++++++++++++++---
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_aggregate.h | 3 +
src/include/catalog/pg_proc.h | 8 +
src/include/utils/json.h | 5 +
src/test/regress/expected/json.out | 24 +++
src/test/regress/sql/json.sql | 12 ++
13 files changed, 699 insertions(+), 21 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2013-03-10 23:19:12 pgsql: Fix race condition in DELETE RETURNING.
Previous Message Peter Eisentraut 2013-03-10 21:17:10 pgsql: doc: Add note about checkpoint_warning vs checkpoint_timeout