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

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: RETURNING clause for JSON() and JSON_SCALAR()
Date: 2022-03-31 19:45:44
Message-ID: E1na0jn-000COS-SU@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2022-03-31 21:05:57 pgsql: Expose a few more PL/pgSQL functions to debugger plugins.
Previous Message Robert Haas 2022-03-31 19:16:57 pgsql: initdb: When running CREATE DATABASE, use STRATEGY = WAL_COPY.