JSON generation improvements.
Andrew Dunstan <andrew@dunslane.net>
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.
Files
| Path | Change | +/− |
|---|---|---|
| contrib/hstore/expected/hstore.out | modified | +36 −0 |
| contrib/hstore/hstore--1.1.sql | modified | +13 −0 |
| contrib/hstore/hstore_io.c | modified | +217 −0 |
| contrib/hstore/sql/hstore.sql | modified | +12 −0 |
| doc/src/sgml/func.sgml | modified | +48 −0 |
| doc/src/sgml/hstore.sgml | modified | +23 −0 |
| src/backend/utils/adt/json.c | modified | +297 −20 |
| src/include/catalog/catversion.h | modified | +1 −1 |
| src/include/catalog/pg_aggregate.h | modified | +3 −0 |
| src/include/catalog/pg_proc.h | modified | +8 −0 |
| src/include/utils/json.h | modified | +5 −0 |
| src/test/regress/expected/json.out | modified | +24 −0 |
| src/test/regress/sql/json.sql | modified | +12 −0 |