pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Amit Langote <amitlan@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: JSON_TABLE: Add support for NESTED paths and columns
Date: Mon, 08 Apr 2024 07:15:33 +0000
Message-ID: <E1rtjE5-0015UB-2S@gemulon.postgresql.org> (raw)

JSON_TABLE: Add support for NESTED paths and columns

A NESTED path allows to extract data from nested levels of JSON
objects given by the parent path expression, which are projected as
columns specified using a nested COLUMNS clause, just like the parent
COLUMNS clause.  Rows comprised from a NESTED columns are "joined"
to the row comprised from the parent columns.  If a particular NESTED
path evaluates to 0 rows, then the nested COLUMNS will emit NULLs,
making it an OUTER join.

NESTED columns themselves may include NESTED paths to allow
extracting data from arbitrary nesting levels, which are likewise
joined against the rows at the parent level.

Multiple NESTED paths at a given level are called "sibling" paths
and their rows are combined by UNIONing them, that is, after being
joined against the parent row as described above.

Author: Nikita Glukhov <n.gluhov@postgrespro.ru>
Author: Teodor Sigaev <teodor@sigaev.ru>
Author: Oleg Bartunov <obartunov@gmail.com>
Author: Alexander Korotkov <aekorotkov@gmail.com>
Author: Andrew Dunstan <andrew@dunslane.net>
Author: Amit Langote <amitlangote09@gmail.com>
Author: Jian He <jian.universality@gmail.com>

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, Jian He

Discussion: https://postgr.es/m/cd0bb935-0158-78a7-08b5-904886deac4b@postgrespro.ru
Discussion: https://postgr.es/m/20220616233130.rparivafipt6doj3@alap3.anarazel.de
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/bb766cde63b4f624d029b34c9cdd3d0a94fd5b46

Modified Files
--------------
doc/src/sgml/func.sgml                             | 154 ++++++++-
src/backend/catalog/sql_features.txt               |   2 +-
src/backend/nodes/nodeFuncs.c                      |   2 +
src/backend/parser/gram.y                          |  38 +-
src/backend/parser/parse_jsontable.c               | 150 +++++++-
src/backend/utils/adt/jsonpath_exec.c              | 168 ++++++++-
src/backend/utils/adt/ruleutils.c                  |  60 +++-
src/include/nodes/parsenodes.h                     |   2 +
src/include/nodes/primnodes.h                      |  34 +-
src/include/parser/kwlist.h                        |   1 +
.../ecpg/test/expected/sql-sqljson_jsontable.c     |  14 +-
.../test/expected/sql-sqljson_jsontable.stderr     |   8 +
.../test/expected/sql-sqljson_jsontable.stdout     |   1 +
src/interfaces/ecpg/test/sql/sqljson_jsontable.pgc |   8 +
src/test/regress/expected/sqljson_jsontable.out    | 385 +++++++++++++++++++++
src/test/regress/sql/sqljson_jsontable.sql         | 210 +++++++++++
src/tools/pgindent/typedefs.list                   |   1 +
17 files changed, 1207 insertions(+), 31 deletions(-)



Message-ID: <E1rtjE5-0015UB-2S@gemulon.postgresql.org>
Permalink:  ../E1rtjE5-0015UB-2S@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1rtjE5-0015UB-2S@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: amitlan@postgresql.org
  Subject: Re: pgsql: JSON_TABLE: Add support for NESTED paths and columns
  In-Reply-To: <E1rtjE5-0015UB-2S@gemulon.postgresql.org>
  References: <E1rtjE5-0015UB-2S@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