Add more SQL/JSON constructor functions
This Patch introduces three SQL standard JSON functions:
JSON()
JSON_SCALAR()
JSON_SERIALIZE()
JSON() produces json values from text, bytea, json or jsonb values,
and has facilitites for handling duplicate keys.
JSON_SCALAR() produces a json value from any scalar sql value,
including json and jsonb.
JSON_SERIALIZE() produces text or bytea from input which containis
or represents json or jsonb;
For the most part these functions don't add any significant new
capabilities, but they will be of use to users wanting standard
compliant JSON handling.
Catversion bumped as this changes ruleutils.c.
Author: Nikita Glukhov <[email protected]>
Author: Teodor Sigaev <[email protected]>
Author: Oleg Bartunov <[email protected]>
Author: Alexander Korotkov <[email protected]>
Author: Andrew Dunstan <[email protected]>
Author: Amit Langote <[email protected]>
Reviewers have included (in no particular order) Andres Freund, Alexander
Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers, Zihong Yu,
Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby, Álvaro Herrera,
Peter Eisentraut
Discussion: https://postgr.es/m/[email protected]
Discussion: https://postgr.es/m/[email protected]
Discussion: https://postgr.es/m/abd9b83b-aa66-f230-3d6d-734817f0995d%40postgresql.org
Discussion: https://postgr.es/m/CA+HiwqE4XTdfb1nW=Ojoy_tQSRhYt-q_kb6i5d4xcKyrLC1Nbg@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/03734a7fed7d924679770adb78a7db8a37d14188
Modified Files
--------------
doc/src/sgml/func.sgml | 66 ++++
src/backend/executor/execExpr.c | 30 ++
src/backend/executor/execExprInterp.c | 41 +++
src/backend/nodes/nodeFuncs.c | 30 ++
src/backend/parser/gram.y | 49 ++-
src/backend/parser/parse_expr.c | 225 +++++++++++++-
src/backend/parser/parse_target.c | 12 +
src/backend/utils/adt/format_type.c | 4 +
src/backend/utils/adt/jsonb.c | 15 +-
src/backend/utils/adt/ruleutils.c | 16 +-
src/include/catalog/catversion.h | 2 +-
src/include/nodes/parsenodes.h | 37 +++
src/include/nodes/primnodes.h | 5 +-
src/include/parser/kwlist.h | 4 +-
src/include/utils/jsonfuncs.h | 2 +-
src/interfaces/ecpg/test/expected/sql-sqljson.c | 204 ++++++++++++-
.../ecpg/test/expected/sql-sqljson.stderr | 201 ++++++++++++-
.../ecpg/test/expected/sql-sqljson.stdout | 16 +
src/interfaces/ecpg/test/sql/sqljson.pgc | 60 ++++
src/test/regress/expected/sqljson.out | 332 +++++++++++++++++++++
src/test/regress/sql/sqljson.sql | 85 ++++++
src/tools/pgindent/typedefs.list | 3 +
22 files changed, 1397 insertions(+), 42 deletions(-)