From: Andrew Dunstan <andrew@dunslane.net>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: IS JSON predicate
Date: Mon, 28 Mar 2022 19:37:30 +0000
Message-ID: <E1nYvBB-001ndQ-Iy@gemulon.postgresql.org> (raw)
IS JSON predicate
This patch intrdocuces the SQL standard IS JSON predicate. It operates
on text and bytea values representing JSON as well as on the json and
jsonb types. Each test has an IS and IS NOT variant. The tests are:
IS JSON [VALUE]
IS JSON ARRAY
IS JSON OBJECT
IS JSON SCALAR
IS JSON WITH | WITHOUT UNIQUE KEYS
These are mostly self-explanatory, but note that IS JSON WITHOUT UNIQUE
KEYS is true whenever IS JSON is true, and IS JSON WITH UNIQUE KEYS is
true whenever IS JSON is true except it IS JSON OBJECT is true and there
are duplicate keys (which is never the case when applied to jsonb values).
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/33a377608fc29cdd1f6b63be561eab0aee5c81f0
Modified Files
--------------
src/backend/executor/execExpr.c | 13 +++
src/backend/executor/execExprInterp.c | 95 ++++++++++++++++
src/backend/jit/llvm/llvmjit_expr.c | 6 ++
src/backend/jit/llvm/llvmjit_types.c | 1 +
src/backend/nodes/copyfuncs.c | 20 ++++
src/backend/nodes/equalfuncs.c | 15 +++
src/backend/nodes/makefuncs.c | 19 ++++
src/backend/nodes/nodeFuncs.c | 26 +++++
src/backend/nodes/outfuncs.c | 14 +++
src/backend/nodes/readfuncs.c | 18 ++++
src/backend/parser/gram.y | 63 ++++++++++-
src/backend/parser/parse_expr.c | 76 +++++++++++++
src/backend/utils/adt/json.c | 105 +++++++++++++++---
src/backend/utils/adt/jsonfuncs.c | 20 ++++
src/backend/utils/adt/ruleutils.c | 35 ++++++
src/backend/utils/misc/queryjumble.c | 10 ++
src/include/executor/execExpr.h | 8 ++
src/include/nodes/makefuncs.h | 3 +
src/include/nodes/nodes.h | 1 +
src/include/nodes/primnodes.h | 26 +++++
src/include/parser/kwlist.h | 1 +
src/include/utils/json.h | 1 +
src/include/utils/jsonfuncs.h | 3 +
src/test/regress/expected/sqljson.out | 198 ++++++++++++++++++++++++++++++++++
src/test/regress/sql/sqljson.sql | 96 +++++++++++++++++
25 files changed, 856 insertions(+), 17 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: IS JSON predicate
In-Reply-To: <E1nYvBB-001ndQ-Iy@gemulon.postgresql.org>
References: <E1nYvBB-001ndQ-Iy@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