From: Alexander Korotkov <akorotkov@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Partial implementation of SQL/JSON path language
Date: Sat, 16 Mar 2019 09:22:02 +0000
Message-ID: <E1h55Vy-00034w-Mi@gemulon.postgresql.org> (raw)
Partial implementation of SQL/JSON path language
SQL 2016 standards among other things contains set of SQL/JSON features for
JSON processing inside of relational database. The core of SQL/JSON is JSON
path language, allowing access parts of JSON documents and make computations
over them. This commit implements partial support JSON path language as
separate datatype called "jsonpath". The implementation is partial because
it's lacking datetime support and suppression of numeric errors. Missing
features will be added later by separate commits.
Support of SQL/JSON features requires implementation of separate nodes, and it
will be considered in subsequent patches. This commit includes following
set of plain functions, allowing to execute jsonpath over jsonb values:
* jsonb_path_exists(jsonb, jsonpath[, jsonb, bool]),
* jsonb_path_match(jsonb, jsonpath[, jsonb, bool]),
* jsonb_path_query(jsonb, jsonpath[, jsonb, bool]),
* jsonb_path_query_array(jsonb, jsonpath[, jsonb, bool]).
* jsonb_path_query_first(jsonb, jsonpath[, jsonb, bool]).
This commit also implements "jsonb @? jsonpath" and "jsonb @@ jsonpath", which
are wrappers over jsonpath_exists(jsonb, jsonpath) and jsonpath_predicate(jsonb,
jsonpath) correspondingly. These operators will have an index support
(implemented in subsequent patches).
Catversion bumped, to add new functions and operators.
Code was written by Nikita Glukhov and Teodor Sigaev, revised by me.
Documentation was written by Oleg Bartunov and Liudmila Mantrova. The work
was inspired by Oleg Bartunov.
Discussion: https://postgr.es/m/fcc6fc6a-b497-f39a-923d-aa34d0c588e8%402ndQuadrant.com
Author: Nikita Glukhov, Teodor Sigaev, Alexander Korotkov, Oleg Bartunov, Liudmila Mantrova
Reviewed-by: Tomas Vondra, Andrew Dunstan, Pavel Stehule, Alexander Korotkov
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/72b6460336e86ad5cafd3426af6013c7d8457367
Modified Files
--------------
doc/src/sgml/biblio.sgml | 11 +
doc/src/sgml/func.sgml | 768 ++++++++-
doc/src/sgml/json.sgml | 237 ++-
src/backend/Makefile | 11 +-
src/backend/catalog/system_views.sql | 40 +
src/backend/utils/adt/.gitignore | 3 +
src/backend/utils/adt/Makefile | 19 +-
src/backend/utils/adt/jsonb.c | 91 +-
src/backend/utils/adt/jsonb_util.c | 8 +
src/backend/utils/adt/jsonpath.c | 1053 ++++++++++++
src/backend/utils/adt/jsonpath_exec.c | 2292 ++++++++++++++++++++++++++
src/backend/utils/adt/jsonpath_gram.y | 480 ++++++
src/backend/utils/adt/jsonpath_scan.l | 638 +++++++
src/backend/utils/adt/regexp.c | 4 +-
src/backend/utils/errcodes.txt | 15 +
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_operator.dat | 8 +
src/include/catalog/pg_proc.dat | 39 +
src/include/catalog/pg_type.dat | 5 +
src/include/regex/regex.h | 8 +
src/include/utils/.gitignore | 1 +
src/include/utils/jsonb.h | 4 +
src/include/utils/jsonpath.h | 245 +++
src/include/utils/jsonpath_scanner.h | 32 +
src/test/regress/expected/jsonb_jsonpath.out | 1756 ++++++++++++++++++++
src/test/regress/expected/jsonpath.out | 806 +++++++++
src/test/regress/parallel_schedule | 7 +-
src/test/regress/serial_schedule | 2 +
src/test/regress/sql/jsonb_jsonpath.sql | 369 +++++
src/test/regress/sql/jsonpath.sql | 147 ++
src/tools/msvc/Mkvcbuild.pm | 2 +
src/tools/msvc/Solution.pm | 18 +
src/tools/pgindent/typedefs.list | 13 +
33 files changed, 9079 insertions(+), 55 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: akorotkov@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Partial implementation of SQL/JSON path language
In-Reply-To: <E1h55Vy-00034w-Mi@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