From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: SQL/JSON: support the IS JSON predicate
Date: Fri, 31 Mar 2023 20:34:34 +0000
Message-ID: <E1piLSC-000i8u-TS@gemulon.postgresql.org> (raw)
SQL/JSON: support the IS JSON predicate
This patch introduces 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 IS and IS NOT variants and supports a WITH
UNIQUE KEYS flag. The tests are:
IS JSON [VALUE]
IS JSON ARRAY
IS JSON OBJECT
IS JSON SCALAR
These should be self-explanatory.
The WITH UNIQUE KEYS flag makes these return false when duplicate keys
exist in any object within the value, not necessarily directly contained
in the outermost object.
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: Amit Langote <amitlangote09@gmail.com>
Author: Andrew Dunstan <andrew@dunslane.net>
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/CAF4Au4w2x-5LTnN_bxky-mq4=WOqsGsxSpENCzHRAzSnEd8+WQ@mail.gmail.com
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
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/6ee30209a6f161d0a267a33f090c70c579c87c00
Modified Files
--------------
doc/src/sgml/func.sgml | 80 +++++++++
src/backend/executor/execExpr.c | 13 ++
src/backend/executor/execExprInterp.c | 99 +++++++++++
src/backend/jit/llvm/llvmjit_expr.c | 6 +
src/backend/jit/llvm/llvmjit_types.c | 1 +
src/backend/nodes/makefuncs.c | 19 ++
src/backend/nodes/nodeFuncs.c | 26 +++
src/backend/parser/gram.y | 68 ++++++-
src/backend/parser/parse_expr.c | 76 ++++++++
src/backend/utils/adt/json.c | 132 +++++++++++++-
src/backend/utils/adt/jsonfuncs.c | 20 +++
src/backend/utils/adt/ruleutils.c | 37 ++++
src/include/catalog/catversion.h | 2 +-
src/include/executor/execExpr.h | 8 +
src/include/nodes/makefuncs.h | 3 +
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/interfaces/ecpg/test/expected/sql-sqljson.c | 71 +++++---
.../ecpg/test/expected/sql-sqljson.stderr | 86 +++++----
.../ecpg/test/expected/sql-sqljson.stdout | 8 +
src/interfaces/ecpg/test/sql/sqljson.pgc | 17 ++
src/test/regress/expected/sqljson.out | 198 +++++++++++++++++++++
src/test/regress/sql/sqljson.sql | 96 ++++++++++
25 files changed, 1030 insertions(+), 67 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 using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: alvherre@alvh.no-ip.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: SQL/JSON: support the IS JSON predicate
In-Reply-To: <E1piLSC-000i8u-TS@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