Thread: pgsql: RETURNING clause for JSON() and JSON_SCALAR()

pgsql: RETURNING clause for JSON() and JSON_SCALAR()

From
Andrew Dunstan
Date:
RETURNING clause for JSON() and JSON_SCALAR()

This patch is extracted from a larger patch that allowed setting the
default returned value from these functions to json or jsonb. That had
problems, but this piece of it is fine. For these functions only json or
jsonb can be specified in the RETURNING clause.

Extracted from an original patch from Nikita Glukhov

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.

Discussion: https://postgr.es/m/cd0bb935-0158-78a7-08b5-904886deac4b@postgrespro.ru

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/49082c2cc3d8167cca70cfe697afb064710828ca

Modified Files
--------------
src/backend/nodes/copyfuncs.c         |  2 ++
src/backend/nodes/equalfuncs.c        |  2 ++
src/backend/nodes/nodeFuncs.c         | 20 ++++++++++--
src/backend/parser/gram.y             |  7 +++--
src/backend/parser/parse_expr.c       | 46 ++++++++++++++++++++++------
src/backend/utils/adt/ruleutils.c     |  5 +--
src/include/nodes/parsenodes.h        |  2 ++
src/test/regress/expected/sqljson.out | 57 +++++++++++++++++++++++++++++++++++
src/test/regress/sql/sqljson.sql      | 10 ++++++
9 files changed, 135 insertions(+), 16 deletions(-)