From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: IS JSON predicate |
Date: | 2022-03-28 19:37:30 |
Message-ID: | E1nYvBB-001ndQ-Iy@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
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(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2022-03-29 00:09:22 | pgsql: Modify query on pg_hba_file_rules to check for errors in regress |
Previous Message | Joe Conway | 2022-03-28 19:11:08 | pgsql: Use has_privs_for_roles for predefined role checks |