diff options
| author | Alexander Korotkov | 2019-03-16 09:15:37 +0000 |
|---|---|---|
| committer | Alexander Korotkov | 2019-03-16 09:16:48 +0000 |
| commit | 72b6460336e86ad5cafd3426af6013c7d8457367 (patch) | |
| tree | 8c590577fcfac501f24d7a282b529bea9d45c6d9 /src/tools | |
| parent | 893d6f8a1f9b43da805124e93cbf0f7aea890ad4 (diff) | |
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
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/msvc/Mkvcbuild.pm | 2 | ||||
| -rw-r--r-- | src/tools/msvc/Solution.pm | 18 | ||||
| -rw-r--r-- | src/tools/pgindent/typedefs.list | 13 |
3 files changed, 33 insertions, 0 deletions
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm index f4225030fc2..726f2ba1671 100644 --- a/src/tools/msvc/Mkvcbuild.pm +++ b/src/tools/msvc/Mkvcbuild.pm @@ -179,6 +179,8 @@ sub mkvcbuild 'src/backend/replication', 'repl_scanner.l', 'repl_gram.y', 'syncrep_scanner.l', 'syncrep_gram.y'); + $postgres->AddFiles('src/backend/utils/adt', 'jsonpath_scan.l', + 'jsonpath_gram.y'); $postgres->AddDefine('BUILDING_DLL'); $postgres->AddLibrary('secur32.lib'); $postgres->AddLibrary('ws2_32.lib'); diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm index 2ea224d7708..90a8d69e99d 100644 --- a/src/tools/msvc/Solution.pm +++ b/src/tools/msvc/Solution.pm @@ -327,6 +327,24 @@ sub GenerateFiles ); } + if (IsNewer( + 'src/backend/utils/adt/jsonpath_gram.h', + 'src/backend/utils/adt/jsonpath_gram.y')) + { + print "Generating jsonpath_gram.h...\n"; + chdir('src/backend/utils/adt'); + system('perl ../../../tools/msvc/pgbison.pl jsonpath_gram.y'); + chdir('../../../..'); + } + + if (IsNewer( + 'src/include/utils/jsonpath_gram.h', + 'src/backend/utils/adt/jsonpath_gram.h')) + { + copyFile('src/backend/utils/adt/jsonpath_gram.h', + 'src/include/utils/jsonpath_gram.h'); + } + if ($self->{options}->{python} && IsNewer( 'src/pl/plpython/spiexceptions.h', diff --git a/src/tools/pgindent/typedefs.list b/src/tools/pgindent/typedefs.list index b821df9e712..b301bce4b1b 100644 --- a/src/tools/pgindent/typedefs.list +++ b/src/tools/pgindent/typedefs.list @@ -1097,14 +1097,27 @@ JoinType JsObject JsValue JsonAggState +JsonBaseObjectInfo JsonHashEntry JsonIterateStringValuesAction JsonLexContext +JsonLikeRegexContext JsonParseContext +JsonPath +JsonPathBool +JsonPathExecContext +JsonPathExecResult +JsonPathItem +JsonPathItemType +JsonPathParseItem +JsonPathParseResult +JsonPathPredicateCallback JsonSemAction JsonTokenType JsonTransformStringValuesAction JsonTypeCategory +JsonValueList +JsonValueListIterator Jsonb JsonbAggState JsonbContainer |
