From: Andrew Dunstan <andrew@dunslane.net>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: SQL JSON functions
Date: Wed, 30 Mar 2022 20:30:51 +0000
Message-ID: <E1nZexv-0003BZ-1w@gemulon.postgresql.org> (raw)
SQL JSON functions
This Patch introduces three SQL standard JSON functions:
JSON() (incorrectly mentioned in my commit message for f4fb45d15c)
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.
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/606948b058dc16bce494270eea577011a602810e
Modified Files
--------------
doc/src/sgml/keywords/sql2016-02-reserved.txt | 3 +
src/backend/executor/execExpr.c | 45 +++++
src/backend/executor/execExprInterp.c | 42 +++-
src/backend/nodes/copyfuncs.c | 53 +++++
src/backend/nodes/equalfuncs.c | 38 ++++
src/backend/nodes/nodeFuncs.c | 14 ++
src/backend/parser/gram.y | 56 +++++-
src/backend/parser/parse_expr.c | 152 +++++++++++++--
src/backend/parser/parse_target.c | 9 +
src/backend/utils/adt/format_type.c | 4 +
src/backend/utils/adt/json.c | 51 +++--
src/backend/utils/adt/jsonb.c | 64 +++---
src/backend/utils/adt/ruleutils.c | 13 +-
src/include/executor/execExpr.h | 5 +
src/include/nodes/nodes.h | 3 +
src/include/nodes/parsenodes.h | 35 ++++
src/include/nodes/primnodes.h | 5 +-
src/include/parser/kwlist.h | 4 +-
src/include/utils/json.h | 21 +-
src/include/utils/jsonb.h | 21 ++
src/test/regress/expected/sqljson.out | 267 ++++++++++++++++++++++++++
src/test/regress/sql/sqljson.sql | 57 ++++++
22 files changed, 880 insertions(+), 82 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: andrew@dunslane.net
Subject: Re: pgsql: SQL JSON functions
In-Reply-To: <E1nZexv-0003BZ-1w@gemulon.postgresql.org>
References: <E1nZexv-0003BZ-1w@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox