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 query functions
Date: Tue, 29 Mar 2022 20:57:37 +0000
Message-ID: <E1nZIuG-001xDg-KJ@gemulon.postgresql.org> (raw )
SQL/JSON query functions
This introduces the SQL/JSON functions for querying JSON data using
jsonpath expressions. The functions are:
JSON_EXISTS()
JSON_QUERY()
JSON_VALUE()
All of these functions only operate on jsonb. The workaround for now is
to cast the argument to jsonb.
JSON_EXISTS() tests if the jsonpath expression applied to the jsonb
value yields any values. JSON_VALUE() must return a single value, and an
error occurs if it tries to return multiple values. JSON_QUERY() must
return a json object or array, and there are various WRAPPER options for
handling scalar or multi-value results. Both these functions have
options for handling EMPTY and ERROR conditions.
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/1a36bc9dba8eae90963a586d37b6457b32b2fed4
Modified Files
--------------
src/backend/executor/execExpr.c | 206 ++++--
src/backend/executor/execExprInterp.c | 543 ++++++++++++++
src/backend/jit/llvm/llvmjit_expr.c | 6 +
src/backend/jit/llvm/llvmjit_types.c | 1 +
src/backend/nodes/copyfuncs.c | 150 ++++
src/backend/nodes/equalfuncs.c | 127 ++++
src/backend/nodes/makefuncs.c | 15 +
src/backend/nodes/nodeFuncs.c | 186 ++++-
src/backend/nodes/outfuncs.c | 70 ++
src/backend/nodes/readfuncs.c | 86 +++
src/backend/optimizer/path/costsize.c | 3 +-
src/backend/optimizer/util/clauses.c | 32 +
src/backend/parser/gram.y | 333 ++++++++-
src/backend/parser/parse_collate.c | 4 +
src/backend/parser/parse_expr.c | 490 ++++++++++++-
src/backend/parser/parse_target.c | 15 +
src/backend/utils/adt/formatting.c | 45 +-
src/backend/utils/adt/jsonb.c | 62 ++
src/backend/utils/adt/jsonfuncs.c | 50 +-
src/backend/utils/adt/jsonpath.c | 257 +++++++
src/backend/utils/adt/jsonpath_exec.c | 350 +++++++--
src/backend/utils/adt/ruleutils.c | 135 ++++
src/backend/utils/misc/queryjumble.c | 21 +
src/include/executor/execExpr.h | 54 ++
src/include/executor/executor.h | 2 +
src/include/nodes/makefuncs.h | 1 +
src/include/nodes/nodes.h | 7 +
src/include/nodes/parsenodes.h | 59 ++
src/include/nodes/primnodes.h | 109 +++
src/include/parser/kwlist.h | 11 +
src/include/utils/formatting.h | 4 +
src/include/utils/jsonb.h | 3 +
src/include/utils/jsonfuncs.h | 4 +
src/include/utils/jsonpath.h | 33 +
src/test/regress/expected/json_sqljson.out | 15 +
src/test/regress/expected/jsonb_sqljson.out | 1018 +++++++++++++++++++++++++++
src/test/regress/parallel_schedule | 2 +-
src/test/regress/sql/json_sqljson.sql | 11 +
src/test/regress/sql/jsonb_sqljson.sql | 317 +++++++++
39 files changed, 4716 insertions(+), 121 deletions(-)
view thread (4+ messages) latest in thread
Message-ID: <E1nZIuG-001xDg-KJ@gemulon.postgresql.org>
Permalink: ../E1nZIuG-001xDg-KJ@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1nZIuG-001xDg-KJ@gemulon.postgresql.org
copy link · copy postgr.es
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 query functions
In-Reply-To: <E1nZIuG-001xDg-KJ@gemulon.postgresql.org>
References: <E1nZIuG-001xDg-KJ@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