pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew@dunslane.net>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: SQL/JSON constructors
Date: Sun, 27 Mar 2022 21:07:46 +0000
Message-ID: <E1nYa6z-001ewM-Td@gemulon.postgresql.org> (raw)

SQL/JSON constructors

This patch introduces the SQL/JSON standard constructors for JSON:

JSON()
JSON_ARRAY()
JSON_ARRAYAGG()
JSON_OBJECT()
JSON_OBJECTAGG()

For the most part these functions provide facilities that mimic
existing json/jsonb functions. However, they also offer some useful
additional functionality. In addition to text input, the JSON() function
accepts bytea input, which it will decode and constuct a json value from.
The other functions provide useful options for handling duplicate keys
and null values.

This series of patches will be followed by a consolidated documentation
patch.

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/f4fb45d15c59d7add2e1b81a9d477d0119a9691a

Modified Files
--------------
src/backend/executor/execExpr.c          |  63 +++
src/backend/executor/execExprInterp.c    |  48 ++
src/backend/jit/llvm/llvmjit_expr.c      |   6 +
src/backend/jit/llvm/llvmjit_types.c     |   1 +
src/backend/nodes/copyfuncs.c            | 173 +++++++
src/backend/nodes/equalfuncs.c           | 132 ++++++
src/backend/nodes/makefuncs.c            |  15 +
src/backend/nodes/nodeFuncs.c            | 152 +++++++
src/backend/nodes/outfuncs.c             |  18 +
src/backend/nodes/readfuncs.c            |  22 +
src/backend/optimizer/util/clauses.c     |  23 +
src/backend/parser/gram.y                | 265 ++++++++++-
src/backend/parser/parse_expr.c          | 589 ++++++++++++++++++++++++
src/backend/parser/parse_target.c        |  13 +
src/backend/parser/parser.c              |  16 +
src/backend/utils/adt/json.c             | 422 +++++++++++++++--
src/backend/utils/adt/jsonb.c            | 224 ++++++++--
src/backend/utils/adt/jsonb_util.c       |  24 +-
src/backend/utils/adt/ruleutils.c        | 212 +++++++--
src/backend/utils/misc/queryjumble.c     |  12 +
src/include/catalog/pg_aggregate.dat     |  22 +
src/include/catalog/pg_proc.dat          |  70 +++
src/include/executor/execExpr.h          |  14 +
src/include/nodes/makefuncs.h            |   1 +
src/include/nodes/nodes.h                |   8 +
src/include/nodes/parsenodes.h           |  96 +++-
src/include/nodes/primnodes.h            |  25 ++
src/include/parser/kwlist.h              |   6 +
src/include/utils/json.h                 |   6 +
src/include/utils/jsonb.h                |   9 +
src/interfaces/ecpg/preproc/parse.pl     |   2 +
src/interfaces/ecpg/preproc/parser.c     |  14 +
src/test/regress/expected/opr_sanity.out |   6 +-
src/test/regress/expected/sqljson.out    | 746 +++++++++++++++++++++++++++++++
src/test/regress/parallel_schedule       |   2 +-
src/test/regress/sql/opr_sanity.sql      |   6 +-
src/test/regress/sql/sqljson.sql         | 282 ++++++++++++
37 files changed, 3615 insertions(+), 130 deletions(-)



Message-ID: <E1nYa6z-001ewM-Td@gemulon.postgresql.org>
Permalink:  ../E1nYa6z-001ewM-Td@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1nYa6z-001ewM-Td@gemulon.postgresql.org

 · 

reply

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 constructors
  In-Reply-To: <E1nYa6z-001ewM-Td@gemulon.postgresql.org>
  References: <E1nYa6z-001ewM-Td@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