mirror of
https://github.com/postgres/postgres.git
synced 2025-12-09 02:08:45 +03:00
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
This commit is contained in:
1756
src/test/regress/expected/jsonb_jsonpath.out
Normal file
1756
src/test/regress/expected/jsonb_jsonpath.out
Normal file
File diff suppressed because it is too large
Load Diff
806
src/test/regress/expected/jsonpath.out
Normal file
806
src/test/regress/expected/jsonpath.out
Normal file
@@ -0,0 +1,806 @@
|
||||
--jsonpath io
|
||||
select ''::jsonpath;
|
||||
ERROR: invalid input syntax for jsonpath: ""
|
||||
LINE 1: select ''::jsonpath;
|
||||
^
|
||||
select '$'::jsonpath;
|
||||
jsonpath
|
||||
----------
|
||||
$
|
||||
(1 row)
|
||||
|
||||
select 'strict $'::jsonpath;
|
||||
jsonpath
|
||||
----------
|
||||
strict $
|
||||
(1 row)
|
||||
|
||||
select 'lax $'::jsonpath;
|
||||
jsonpath
|
||||
----------
|
||||
$
|
||||
(1 row)
|
||||
|
||||
select '$.a'::jsonpath;
|
||||
jsonpath
|
||||
----------
|
||||
$."a"
|
||||
(1 row)
|
||||
|
||||
select '$.a.v'::jsonpath;
|
||||
jsonpath
|
||||
-----------
|
||||
$."a"."v"
|
||||
(1 row)
|
||||
|
||||
select '$.a.*'::jsonpath;
|
||||
jsonpath
|
||||
----------
|
||||
$."a".*
|
||||
(1 row)
|
||||
|
||||
select '$.*[*]'::jsonpath;
|
||||
jsonpath
|
||||
----------
|
||||
$.*[*]
|
||||
(1 row)
|
||||
|
||||
select '$.a[*]'::jsonpath;
|
||||
jsonpath
|
||||
----------
|
||||
$."a"[*]
|
||||
(1 row)
|
||||
|
||||
select '$.a[*][*]'::jsonpath;
|
||||
jsonpath
|
||||
-------------
|
||||
$."a"[*][*]
|
||||
(1 row)
|
||||
|
||||
select '$[*]'::jsonpath;
|
||||
jsonpath
|
||||
----------
|
||||
$[*]
|
||||
(1 row)
|
||||
|
||||
select '$[0]'::jsonpath;
|
||||
jsonpath
|
||||
----------
|
||||
$[0]
|
||||
(1 row)
|
||||
|
||||
select '$[*][0]'::jsonpath;
|
||||
jsonpath
|
||||
----------
|
||||
$[*][0]
|
||||
(1 row)
|
||||
|
||||
select '$[*].a'::jsonpath;
|
||||
jsonpath
|
||||
----------
|
||||
$[*]."a"
|
||||
(1 row)
|
||||
|
||||
select '$[*][0].a.b'::jsonpath;
|
||||
jsonpath
|
||||
-----------------
|
||||
$[*][0]."a"."b"
|
||||
(1 row)
|
||||
|
||||
select '$.a.**.b'::jsonpath;
|
||||
jsonpath
|
||||
--------------
|
||||
$."a".**."b"
|
||||
(1 row)
|
||||
|
||||
select '$.a.**{2}.b'::jsonpath;
|
||||
jsonpath
|
||||
-----------------
|
||||
$."a".**{2}."b"
|
||||
(1 row)
|
||||
|
||||
select '$.a.**{2 to 2}.b'::jsonpath;
|
||||
jsonpath
|
||||
-----------------
|
||||
$."a".**{2}."b"
|
||||
(1 row)
|
||||
|
||||
select '$.a.**{2 to 5}.b'::jsonpath;
|
||||
jsonpath
|
||||
----------------------
|
||||
$."a".**{2 to 5}."b"
|
||||
(1 row)
|
||||
|
||||
select '$.a.**{0 to 5}.b'::jsonpath;
|
||||
jsonpath
|
||||
----------------------
|
||||
$."a".**{0 to 5}."b"
|
||||
(1 row)
|
||||
|
||||
select '$.a.**{5 to last}.b'::jsonpath;
|
||||
jsonpath
|
||||
-------------------------
|
||||
$."a".**{5 to last}."b"
|
||||
(1 row)
|
||||
|
||||
select '$.a.**{last}.b'::jsonpath;
|
||||
jsonpath
|
||||
--------------------
|
||||
$."a".**{last}."b"
|
||||
(1 row)
|
||||
|
||||
select '$.a.**{last to 5}.b'::jsonpath;
|
||||
jsonpath
|
||||
-------------------------
|
||||
$."a".**{last to 5}."b"
|
||||
(1 row)
|
||||
|
||||
select '$+1'::jsonpath;
|
||||
jsonpath
|
||||
----------
|
||||
($ + 1)
|
||||
(1 row)
|
||||
|
||||
select '$-1'::jsonpath;
|
||||
jsonpath
|
||||
----------
|
||||
($ - 1)
|
||||
(1 row)
|
||||
|
||||
select '$--+1'::jsonpath;
|
||||
jsonpath
|
||||
----------
|
||||
($ - -1)
|
||||
(1 row)
|
||||
|
||||
select '$.a/+-1'::jsonpath;
|
||||
jsonpath
|
||||
--------------
|
||||
($."a" / -1)
|
||||
(1 row)
|
||||
|
||||
select '1 * 2 + 4 % -3 != false'::jsonpath;
|
||||
jsonpath
|
||||
---------------------------
|
||||
(1 * 2 + 4 % -3 != false)
|
||||
(1 row)
|
||||
|
||||
select '"\b\f\r\n\t\v\"\''\\"'::jsonpath;
|
||||
jsonpath
|
||||
-------------------------
|
||||
"\b\f\r\n\t\u000b\"'\\"
|
||||
(1 row)
|
||||
|
||||
select '''\b\f\r\n\t\v\"\''\\'''::jsonpath;
|
||||
jsonpath
|
||||
-------------------------
|
||||
"\b\f\r\n\t\u000b\"'\\"
|
||||
(1 row)
|
||||
|
||||
select '"\x50\u0067\u{53}\u{051}\u{00004C}"'::jsonpath;
|
||||
jsonpath
|
||||
----------
|
||||
"PgSQL"
|
||||
(1 row)
|
||||
|
||||
select '''\x50\u0067\u{53}\u{051}\u{00004C}'''::jsonpath;
|
||||
jsonpath
|
||||
----------
|
||||
"PgSQL"
|
||||
(1 row)
|
||||
|
||||
select '$.foo\x50\u0067\u{53}\u{051}\u{00004C}\t\"bar'::jsonpath;
|
||||
jsonpath
|
||||
---------------------
|
||||
$."fooPgSQL\t\"bar"
|
||||
(1 row)
|
||||
|
||||
select '$.g ? ($.a == 1)'::jsonpath;
|
||||
jsonpath
|
||||
--------------------
|
||||
$."g"?($."a" == 1)
|
||||
(1 row)
|
||||
|
||||
select '$.g ? (@ == 1)'::jsonpath;
|
||||
jsonpath
|
||||
----------------
|
||||
$."g"?(@ == 1)
|
||||
(1 row)
|
||||
|
||||
select '$.g ? (@.a == 1)'::jsonpath;
|
||||
jsonpath
|
||||
--------------------
|
||||
$."g"?(@."a" == 1)
|
||||
(1 row)
|
||||
|
||||
select '$.g ? (@.a == 1 || @.a == 4)'::jsonpath;
|
||||
jsonpath
|
||||
----------------------------------
|
||||
$."g"?(@."a" == 1 || @."a" == 4)
|
||||
(1 row)
|
||||
|
||||
select '$.g ? (@.a == 1 && @.a == 4)'::jsonpath;
|
||||
jsonpath
|
||||
----------------------------------
|
||||
$."g"?(@."a" == 1 && @."a" == 4)
|
||||
(1 row)
|
||||
|
||||
select '$.g ? (@.a == 1 || @.a == 4 && @.b == 7)'::jsonpath;
|
||||
jsonpath
|
||||
------------------------------------------------
|
||||
$."g"?(@."a" == 1 || @."a" == 4 && @."b" == 7)
|
||||
(1 row)
|
||||
|
||||
select '$.g ? (@.a == 1 || !(@.a == 4) && @.b == 7)'::jsonpath;
|
||||
jsonpath
|
||||
---------------------------------------------------
|
||||
$."g"?(@."a" == 1 || !(@."a" == 4) && @."b" == 7)
|
||||
(1 row)
|
||||
|
||||
select '$.g ? (@.a == 1 || !(@.x >= 123 || @.a == 4) && @.b == 7)'::jsonpath;
|
||||
jsonpath
|
||||
-------------------------------------------------------------------
|
||||
$."g"?(@."a" == 1 || !(@."x" >= 123 || @."a" == 4) && @."b" == 7)
|
||||
(1 row)
|
||||
|
||||
select '$.g ? (@.x >= @[*]?(@.a > "abc"))'::jsonpath;
|
||||
jsonpath
|
||||
---------------------------------------
|
||||
$."g"?(@."x" >= @[*]?(@."a" > "abc"))
|
||||
(1 row)
|
||||
|
||||
select '$.g ? ((@.x >= 123 || @.a == 4) is unknown)'::jsonpath;
|
||||
jsonpath
|
||||
-------------------------------------------------
|
||||
$."g"?((@."x" >= 123 || @."a" == 4) is unknown)
|
||||
(1 row)
|
||||
|
||||
select '$.g ? (exists (@.x))'::jsonpath;
|
||||
jsonpath
|
||||
------------------------
|
||||
$."g"?(exists (@."x"))
|
||||
(1 row)
|
||||
|
||||
select '$.g ? (exists (@.x ? (@ == 14)))'::jsonpath;
|
||||
jsonpath
|
||||
----------------------------------
|
||||
$."g"?(exists (@."x"?(@ == 14)))
|
||||
(1 row)
|
||||
|
||||
select '$.g ? ((@.x >= 123 || @.a == 4) && exists (@.x ? (@ == 14)))'::jsonpath;
|
||||
jsonpath
|
||||
------------------------------------------------------------------
|
||||
$."g"?((@."x" >= 123 || @."a" == 4) && exists (@."x"?(@ == 14)))
|
||||
(1 row)
|
||||
|
||||
select '$.g ? (+@.x >= +-(+@.a + 2))'::jsonpath;
|
||||
jsonpath
|
||||
------------------------------------
|
||||
$."g"?(+@."x" >= +(-(+@."a" + 2)))
|
||||
(1 row)
|
||||
|
||||
select '$a'::jsonpath;
|
||||
jsonpath
|
||||
----------
|
||||
$"a"
|
||||
(1 row)
|
||||
|
||||
select '$a.b'::jsonpath;
|
||||
jsonpath
|
||||
----------
|
||||
$"a"."b"
|
||||
(1 row)
|
||||
|
||||
select '$a[*]'::jsonpath;
|
||||
jsonpath
|
||||
----------
|
||||
$"a"[*]
|
||||
(1 row)
|
||||
|
||||
select '$.g ? (@.zip == $zip)'::jsonpath;
|
||||
jsonpath
|
||||
---------------------------
|
||||
$."g"?(@."zip" == $"zip")
|
||||
(1 row)
|
||||
|
||||
select '$.a[1,2, 3 to 16]'::jsonpath;
|
||||
jsonpath
|
||||
--------------------
|
||||
$."a"[1,2,3 to 16]
|
||||
(1 row)
|
||||
|
||||
select '$.a[$a + 1, ($b[*]) to -($[0] * 2)]'::jsonpath;
|
||||
jsonpath
|
||||
----------------------------------------
|
||||
$."a"[$"a" + 1,$"b"[*] to -($[0] * 2)]
|
||||
(1 row)
|
||||
|
||||
select '$.a[$.a.size() - 3]'::jsonpath;
|
||||
jsonpath
|
||||
-------------------------
|
||||
$."a"[$."a".size() - 3]
|
||||
(1 row)
|
||||
|
||||
select 'last'::jsonpath;
|
||||
ERROR: LAST is allowed only in array subscripts
|
||||
LINE 1: select 'last'::jsonpath;
|
||||
^
|
||||
select '"last"'::jsonpath;
|
||||
jsonpath
|
||||
----------
|
||||
"last"
|
||||
(1 row)
|
||||
|
||||
select '$.last'::jsonpath;
|
||||
jsonpath
|
||||
----------
|
||||
$."last"
|
||||
(1 row)
|
||||
|
||||
select '$ ? (last > 0)'::jsonpath;
|
||||
ERROR: LAST is allowed only in array subscripts
|
||||
LINE 1: select '$ ? (last > 0)'::jsonpath;
|
||||
^
|
||||
select '$[last]'::jsonpath;
|
||||
jsonpath
|
||||
----------
|
||||
$[last]
|
||||
(1 row)
|
||||
|
||||
select '$[$[0] ? (last > 0)]'::jsonpath;
|
||||
jsonpath
|
||||
--------------------
|
||||
$[$[0]?(last > 0)]
|
||||
(1 row)
|
||||
|
||||
select 'null.type()'::jsonpath;
|
||||
jsonpath
|
||||
-------------
|
||||
null.type()
|
||||
(1 row)
|
||||
|
||||
select '1.type()'::jsonpath;
|
||||
jsonpath
|
||||
----------
|
||||
1.type()
|
||||
(1 row)
|
||||
|
||||
select '"aaa".type()'::jsonpath;
|
||||
jsonpath
|
||||
--------------
|
||||
"aaa".type()
|
||||
(1 row)
|
||||
|
||||
select 'true.type()'::jsonpath;
|
||||
jsonpath
|
||||
-------------
|
||||
true.type()
|
||||
(1 row)
|
||||
|
||||
select '$.double().floor().ceiling().abs()'::jsonpath;
|
||||
jsonpath
|
||||
------------------------------------
|
||||
$.double().floor().ceiling().abs()
|
||||
(1 row)
|
||||
|
||||
select '$.keyvalue().key'::jsonpath;
|
||||
jsonpath
|
||||
--------------------
|
||||
$.keyvalue()."key"
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@ starts with "abc")'::jsonpath;
|
||||
jsonpath
|
||||
-------------------------
|
||||
$?(@ starts with "abc")
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@ starts with $var)'::jsonpath;
|
||||
jsonpath
|
||||
--------------------------
|
||||
$?(@ starts with $"var")
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@ like_regex "(invalid pattern")'::jsonpath;
|
||||
ERROR: invalid regular expression: parentheses () not balanced
|
||||
LINE 1: select '$ ? (@ like_regex "(invalid pattern")'::jsonpath;
|
||||
^
|
||||
select '$ ? (@ like_regex "pattern")'::jsonpath;
|
||||
jsonpath
|
||||
----------------------------
|
||||
$?(@ like_regex "pattern")
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@ like_regex "pattern" flag "")'::jsonpath;
|
||||
jsonpath
|
||||
----------------------------
|
||||
$?(@ like_regex "pattern")
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@ like_regex "pattern" flag "i")'::jsonpath;
|
||||
jsonpath
|
||||
-------------------------------------
|
||||
$?(@ like_regex "pattern" flag "i")
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@ like_regex "pattern" flag "is")'::jsonpath;
|
||||
jsonpath
|
||||
--------------------------------------
|
||||
$?(@ like_regex "pattern" flag "is")
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@ like_regex "pattern" flag "isim")'::jsonpath;
|
||||
jsonpath
|
||||
--------------------------------------
|
||||
$?(@ like_regex "pattern" flag "im")
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@ like_regex "pattern" flag "xsms")'::jsonpath;
|
||||
jsonpath
|
||||
--------------------------------------
|
||||
$?(@ like_regex "pattern" flag "sx")
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@ like_regex "pattern" flag "a")'::jsonpath;
|
||||
ERROR: bad jsonpath representation
|
||||
LINE 1: select '$ ? (@ like_regex "pattern" flag "a")'::jsonpath;
|
||||
^
|
||||
DETAIL: unrecognized flag of LIKE_REGEX predicate at or near """
|
||||
select '$ < 1'::jsonpath;
|
||||
jsonpath
|
||||
----------
|
||||
($ < 1)
|
||||
(1 row)
|
||||
|
||||
select '($ < 1) || $.a.b <= $x'::jsonpath;
|
||||
jsonpath
|
||||
------------------------------
|
||||
($ < 1 || $."a"."b" <= $"x")
|
||||
(1 row)
|
||||
|
||||
select '@ + 1'::jsonpath;
|
||||
ERROR: @ is not allowed in root expressions
|
||||
LINE 1: select '@ + 1'::jsonpath;
|
||||
^
|
||||
select '($).a.b'::jsonpath;
|
||||
jsonpath
|
||||
-----------
|
||||
$."a"."b"
|
||||
(1 row)
|
||||
|
||||
select '($.a.b).c.d'::jsonpath;
|
||||
jsonpath
|
||||
-------------------
|
||||
$."a"."b"."c"."d"
|
||||
(1 row)
|
||||
|
||||
select '($.a.b + -$.x.y).c.d'::jsonpath;
|
||||
jsonpath
|
||||
----------------------------------
|
||||
($."a"."b" + -$."x"."y")."c"."d"
|
||||
(1 row)
|
||||
|
||||
select '(-+$.a.b).c.d'::jsonpath;
|
||||
jsonpath
|
||||
-------------------------
|
||||
(-(+$."a"."b"))."c"."d"
|
||||
(1 row)
|
||||
|
||||
select '1 + ($.a.b + 2).c.d'::jsonpath;
|
||||
jsonpath
|
||||
-------------------------------
|
||||
(1 + ($."a"."b" + 2)."c"."d")
|
||||
(1 row)
|
||||
|
||||
select '1 + ($.a.b > 2).c.d'::jsonpath;
|
||||
jsonpath
|
||||
-------------------------------
|
||||
(1 + ($."a"."b" > 2)."c"."d")
|
||||
(1 row)
|
||||
|
||||
select '($)'::jsonpath;
|
||||
jsonpath
|
||||
----------
|
||||
$
|
||||
(1 row)
|
||||
|
||||
select '(($))'::jsonpath;
|
||||
jsonpath
|
||||
----------
|
||||
$
|
||||
(1 row)
|
||||
|
||||
select '((($ + 1)).a + ((2)).b ? ((((@ > 1)) || (exists(@.c)))))'::jsonpath;
|
||||
jsonpath
|
||||
-------------------------------------------------
|
||||
(($ + 1)."a" + 2."b"?(@ > 1 || exists (@."c")))
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < 1)'::jsonpath;
|
||||
jsonpath
|
||||
---------------
|
||||
$?(@."a" < 1)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < -1)'::jsonpath;
|
||||
jsonpath
|
||||
----------------
|
||||
$?(@."a" < -1)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < +1)'::jsonpath;
|
||||
jsonpath
|
||||
---------------
|
||||
$?(@."a" < 1)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < .1)'::jsonpath;
|
||||
jsonpath
|
||||
-----------------
|
||||
$?(@."a" < 0.1)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < -.1)'::jsonpath;
|
||||
jsonpath
|
||||
------------------
|
||||
$?(@."a" < -0.1)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < +.1)'::jsonpath;
|
||||
jsonpath
|
||||
-----------------
|
||||
$?(@."a" < 0.1)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < 0.1)'::jsonpath;
|
||||
jsonpath
|
||||
-----------------
|
||||
$?(@."a" < 0.1)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < -0.1)'::jsonpath;
|
||||
jsonpath
|
||||
------------------
|
||||
$?(@."a" < -0.1)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < +0.1)'::jsonpath;
|
||||
jsonpath
|
||||
-----------------
|
||||
$?(@."a" < 0.1)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < 10.1)'::jsonpath;
|
||||
jsonpath
|
||||
------------------
|
||||
$?(@."a" < 10.1)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < -10.1)'::jsonpath;
|
||||
jsonpath
|
||||
-------------------
|
||||
$?(@."a" < -10.1)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < +10.1)'::jsonpath;
|
||||
jsonpath
|
||||
------------------
|
||||
$?(@."a" < 10.1)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < 1e1)'::jsonpath;
|
||||
jsonpath
|
||||
----------------
|
||||
$?(@."a" < 10)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < -1e1)'::jsonpath;
|
||||
jsonpath
|
||||
-----------------
|
||||
$?(@."a" < -10)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < +1e1)'::jsonpath;
|
||||
jsonpath
|
||||
----------------
|
||||
$?(@."a" < 10)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < .1e1)'::jsonpath;
|
||||
jsonpath
|
||||
---------------
|
||||
$?(@."a" < 1)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < -.1e1)'::jsonpath;
|
||||
jsonpath
|
||||
----------------
|
||||
$?(@."a" < -1)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < +.1e1)'::jsonpath;
|
||||
jsonpath
|
||||
---------------
|
||||
$?(@."a" < 1)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < 0.1e1)'::jsonpath;
|
||||
jsonpath
|
||||
---------------
|
||||
$?(@."a" < 1)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < -0.1e1)'::jsonpath;
|
||||
jsonpath
|
||||
----------------
|
||||
$?(@."a" < -1)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < +0.1e1)'::jsonpath;
|
||||
jsonpath
|
||||
---------------
|
||||
$?(@."a" < 1)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < 10.1e1)'::jsonpath;
|
||||
jsonpath
|
||||
-----------------
|
||||
$?(@."a" < 101)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < -10.1e1)'::jsonpath;
|
||||
jsonpath
|
||||
------------------
|
||||
$?(@."a" < -101)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < +10.1e1)'::jsonpath;
|
||||
jsonpath
|
||||
-----------------
|
||||
$?(@."a" < 101)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < 1e-1)'::jsonpath;
|
||||
jsonpath
|
||||
-----------------
|
||||
$?(@."a" < 0.1)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < -1e-1)'::jsonpath;
|
||||
jsonpath
|
||||
------------------
|
||||
$?(@."a" < -0.1)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < +1e-1)'::jsonpath;
|
||||
jsonpath
|
||||
-----------------
|
||||
$?(@."a" < 0.1)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < .1e-1)'::jsonpath;
|
||||
jsonpath
|
||||
------------------
|
||||
$?(@."a" < 0.01)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < -.1e-1)'::jsonpath;
|
||||
jsonpath
|
||||
-------------------
|
||||
$?(@."a" < -0.01)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < +.1e-1)'::jsonpath;
|
||||
jsonpath
|
||||
------------------
|
||||
$?(@."a" < 0.01)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < 0.1e-1)'::jsonpath;
|
||||
jsonpath
|
||||
------------------
|
||||
$?(@."a" < 0.01)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < -0.1e-1)'::jsonpath;
|
||||
jsonpath
|
||||
-------------------
|
||||
$?(@."a" < -0.01)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < +0.1e-1)'::jsonpath;
|
||||
jsonpath
|
||||
------------------
|
||||
$?(@."a" < 0.01)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < 10.1e-1)'::jsonpath;
|
||||
jsonpath
|
||||
------------------
|
||||
$?(@."a" < 1.01)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < -10.1e-1)'::jsonpath;
|
||||
jsonpath
|
||||
-------------------
|
||||
$?(@."a" < -1.01)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < +10.1e-1)'::jsonpath;
|
||||
jsonpath
|
||||
------------------
|
||||
$?(@."a" < 1.01)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < 1e+1)'::jsonpath;
|
||||
jsonpath
|
||||
----------------
|
||||
$?(@."a" < 10)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < -1e+1)'::jsonpath;
|
||||
jsonpath
|
||||
-----------------
|
||||
$?(@."a" < -10)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < +1e+1)'::jsonpath;
|
||||
jsonpath
|
||||
----------------
|
||||
$?(@."a" < 10)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < .1e+1)'::jsonpath;
|
||||
jsonpath
|
||||
---------------
|
||||
$?(@."a" < 1)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < -.1e+1)'::jsonpath;
|
||||
jsonpath
|
||||
----------------
|
||||
$?(@."a" < -1)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < +.1e+1)'::jsonpath;
|
||||
jsonpath
|
||||
---------------
|
||||
$?(@."a" < 1)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < 0.1e+1)'::jsonpath;
|
||||
jsonpath
|
||||
---------------
|
||||
$?(@."a" < 1)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < -0.1e+1)'::jsonpath;
|
||||
jsonpath
|
||||
----------------
|
||||
$?(@."a" < -1)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < +0.1e+1)'::jsonpath;
|
||||
jsonpath
|
||||
---------------
|
||||
$?(@."a" < 1)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < 10.1e+1)'::jsonpath;
|
||||
jsonpath
|
||||
-----------------
|
||||
$?(@."a" < 101)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < -10.1e+1)'::jsonpath;
|
||||
jsonpath
|
||||
------------------
|
||||
$?(@."a" < -101)
|
||||
(1 row)
|
||||
|
||||
select '$ ? (@.a < +10.1e+1)'::jsonpath;
|
||||
jsonpath
|
||||
-----------------
|
||||
$?(@."a" < 101)
|
||||
(1 row)
|
||||
|
||||
@@ -104,7 +104,12 @@ test: publication subscription
|
||||
# ----------
|
||||
# Another group of parallel tests
|
||||
# ----------
|
||||
test: select_views portals_p2 foreign_key cluster dependency guc bitmapops combocid tsearch tsdicts foreign_data window xmlmap functional_deps advisory_lock json jsonb json_encoding indirect_toast equivclass
|
||||
test: select_views portals_p2 foreign_key cluster dependency guc bitmapops combocid tsearch tsdicts foreign_data window xmlmap functional_deps advisory_lock indirect_toast equivclass
|
||||
|
||||
# ----------
|
||||
# Another group of parallel tests (JSON related)
|
||||
# ----------
|
||||
test: json jsonb json_encoding jsonpath jsonb_jsonpath
|
||||
|
||||
# ----------
|
||||
# Another group of parallel tests
|
||||
|
||||
@@ -159,6 +159,8 @@ test: advisory_lock
|
||||
test: json
|
||||
test: jsonb
|
||||
test: json_encoding
|
||||
test: jsonpath
|
||||
test: jsonb_jsonpath
|
||||
test: indirect_toast
|
||||
test: equivclass
|
||||
test: plancache
|
||||
|
||||
369
src/test/regress/sql/jsonb_jsonpath.sql
Normal file
369
src/test/regress/sql/jsonb_jsonpath.sql
Normal file
@@ -0,0 +1,369 @@
|
||||
select jsonb '{"a": 12}' @? '$';
|
||||
select jsonb '{"a": 12}' @? '1';
|
||||
select jsonb '{"a": 12}' @? '$.a.b';
|
||||
select jsonb '{"a": 12}' @? '$.b';
|
||||
select jsonb '{"a": 12}' @? '$.a + 2';
|
||||
select jsonb '{"a": 12}' @? '$.b + 2';
|
||||
select jsonb '{"a": {"a": 12}}' @? '$.a.a';
|
||||
select jsonb '{"a": {"a": 12}}' @? '$.*.a';
|
||||
select jsonb '{"b": {"a": 12}}' @? '$.*.a';
|
||||
select jsonb '{"b": {"a": 12}}' @? '$.*.b';
|
||||
select jsonb '{"b": {"a": 12}}' @? 'strict $.*.b';
|
||||
select jsonb '{}' @? '$.*';
|
||||
select jsonb '{"a": 1}' @? '$.*';
|
||||
select jsonb '{"a": {"b": 1}}' @? 'lax $.**{1}';
|
||||
select jsonb '{"a": {"b": 1}}' @? 'lax $.**{2}';
|
||||
select jsonb '{"a": {"b": 1}}' @? 'lax $.**{3}';
|
||||
select jsonb '[]' @? '$[*]';
|
||||
select jsonb '[1]' @? '$[*]';
|
||||
select jsonb '[1]' @? '$[1]';
|
||||
select jsonb '[1]' @? 'strict $[1]';
|
||||
select jsonb_path_query('[1]', 'strict $[1]');
|
||||
select jsonb_path_query('[1]', 'strict $[1]', silent => true);
|
||||
select jsonb '[1]' @? 'lax $[10000000000000000]';
|
||||
select jsonb '[1]' @? 'strict $[10000000000000000]';
|
||||
select jsonb_path_query('[1]', 'lax $[10000000000000000]');
|
||||
select jsonb_path_query('[1]', 'strict $[10000000000000000]');
|
||||
select jsonb '[1]' @? '$[0]';
|
||||
select jsonb '[1]' @? '$[0.3]';
|
||||
select jsonb '[1]' @? '$[0.5]';
|
||||
select jsonb '[1]' @? '$[0.9]';
|
||||
select jsonb '[1]' @? '$[1.2]';
|
||||
select jsonb '[1]' @? 'strict $[1.2]';
|
||||
select jsonb '{"a": [1,2,3], "b": [3,4,5]}' @? '$ ? (@.a[*] > @.b[*])';
|
||||
select jsonb '{"a": [1,2,3], "b": [3,4,5]}' @? '$ ? (@.a[*] >= @.b[*])';
|
||||
select jsonb '{"a": [1,2,3], "b": [3,4,"5"]}' @? '$ ? (@.a[*] >= @.b[*])';
|
||||
select jsonb '{"a": [1,2,3], "b": [3,4,"5"]}' @? 'strict $ ? (@.a[*] >= @.b[*])';
|
||||
select jsonb '{"a": [1,2,3], "b": [3,4,null]}' @? '$ ? (@.a[*] >= @.b[*])';
|
||||
select jsonb '1' @? '$ ? ((@ == "1") is unknown)';
|
||||
select jsonb '1' @? '$ ? ((@ == 1) is unknown)';
|
||||
select jsonb '[{"a": 1}, {"a": 2}]' @? '$[0 to 1] ? (@.a > 1)';
|
||||
|
||||
select jsonb_path_exists('[{"a": 1}, {"a": 2}, 3]', 'lax $[*].a', silent => false);
|
||||
select jsonb_path_exists('[{"a": 1}, {"a": 2}, 3]', 'lax $[*].a', silent => true);
|
||||
select jsonb_path_exists('[{"a": 1}, {"a": 2}, 3]', 'strict $[*].a', silent => false);
|
||||
select jsonb_path_exists('[{"a": 1}, {"a": 2}, 3]', 'strict $[*].a', silent => true);
|
||||
|
||||
select jsonb_path_query('1', 'lax $.a');
|
||||
select jsonb_path_query('1', 'strict $.a');
|
||||
select jsonb_path_query('1', 'strict $.*');
|
||||
select jsonb_path_query('1', 'strict $.a', silent => true);
|
||||
select jsonb_path_query('1', 'strict $.*', silent => true);
|
||||
select jsonb_path_query('[]', 'lax $.a');
|
||||
select jsonb_path_query('[]', 'strict $.a');
|
||||
select jsonb_path_query('[]', 'strict $.a', silent => true);
|
||||
select jsonb_path_query('{}', 'lax $.a');
|
||||
select jsonb_path_query('{}', 'strict $.a');
|
||||
select jsonb_path_query('{}', 'strict $.a', silent => true);
|
||||
|
||||
select jsonb_path_query('1', 'strict $[1]');
|
||||
select jsonb_path_query('1', 'strict $[*]');
|
||||
select jsonb_path_query('[]', 'strict $[1]');
|
||||
select jsonb_path_query('[]', 'strict $["a"]');
|
||||
select jsonb_path_query('1', 'strict $[1]', silent => true);
|
||||
select jsonb_path_query('1', 'strict $[*]', silent => true);
|
||||
select jsonb_path_query('[]', 'strict $[1]', silent => true);
|
||||
select jsonb_path_query('[]', 'strict $["a"]', silent => true);
|
||||
|
||||
select jsonb_path_query('{"a": 12, "b": {"a": 13}}', '$.a');
|
||||
select jsonb_path_query('{"a": 12, "b": {"a": 13}}', '$.b');
|
||||
select jsonb_path_query('{"a": 12, "b": {"a": 13}}', '$.*');
|
||||
select jsonb_path_query('{"a": 12, "b": {"a": 13}}', 'lax $.*.a');
|
||||
select jsonb_path_query('[12, {"a": 13}, {"b": 14}]', 'lax $[*].a');
|
||||
select jsonb_path_query('[12, {"a": 13}, {"b": 14}]', 'lax $[*].*');
|
||||
select jsonb_path_query('[12, {"a": 13}, {"b": 14}]', 'lax $[0].a');
|
||||
select jsonb_path_query('[12, {"a": 13}, {"b": 14}]', 'lax $[1].a');
|
||||
select jsonb_path_query('[12, {"a": 13}, {"b": 14}]', 'lax $[2].a');
|
||||
select jsonb_path_query('[12, {"a": 13}, {"b": 14}]', 'lax $[0,1].a');
|
||||
select jsonb_path_query('[12, {"a": 13}, {"b": 14}]', 'lax $[0 to 10].a');
|
||||
select jsonb_path_query('[12, {"a": 13}, {"b": 14}]', 'lax $[0 to 10 / 0].a');
|
||||
select jsonb_path_query('[12, {"a": 13}, {"b": 14}, "ccc", true]', '$[2.5 - 1 to $.size() - 2]');
|
||||
select jsonb_path_query('1', 'lax $[0]');
|
||||
select jsonb_path_query('1', 'lax $[*]');
|
||||
select jsonb_path_query('[1]', 'lax $[0]');
|
||||
select jsonb_path_query('[1]', 'lax $[*]');
|
||||
select jsonb_path_query('[1,2,3]', 'lax $[*]');
|
||||
select jsonb_path_query('[1,2,3]', 'strict $[*].a');
|
||||
select jsonb_path_query('[1,2,3]', 'strict $[*].a', silent => true);
|
||||
select jsonb_path_query('[]', '$[last]');
|
||||
select jsonb_path_query('[]', '$[last ? (exists(last))]');
|
||||
select jsonb_path_query('[]', 'strict $[last]');
|
||||
select jsonb_path_query('[]', 'strict $[last]', silent => true);
|
||||
select jsonb_path_query('[1]', '$[last]');
|
||||
select jsonb_path_query('[1,2,3]', '$[last]');
|
||||
select jsonb_path_query('[1,2,3]', '$[last - 1]');
|
||||
select jsonb_path_query('[1,2,3]', '$[last ? (@.type() == "number")]');
|
||||
select jsonb_path_query('[1,2,3]', '$[last ? (@.type() == "string")]');
|
||||
select jsonb_path_query('[1,2,3]', '$[last ? (@.type() == "string")]', silent => true);
|
||||
|
||||
select * from jsonb_path_query('{"a": 10}', '$');
|
||||
select * from jsonb_path_query('{"a": 10}', '$ ? (@.a < $value)');
|
||||
select * from jsonb_path_query('{"a": 10}', '$ ? (@.a < $value)', '1');
|
||||
select * from jsonb_path_query('{"a": 10}', '$ ? (@.a < $value)', '[{"value" : 13}]');
|
||||
select * from jsonb_path_query('{"a": 10}', '$ ? (@.a < $value)', '{"value" : 13}');
|
||||
select * from jsonb_path_query('{"a": 10}', '$ ? (@.a < $value)', '{"value" : 8}');
|
||||
select * from jsonb_path_query('{"a": 10}', '$.a ? (@ < $value)', '{"value" : 13}');
|
||||
select * from jsonb_path_query('[10,11,12,13,14,15]', '$[*] ? (@ < $value)', '{"value" : 13}');
|
||||
select * from jsonb_path_query('[10,11,12,13,14,15]', '$[0,1] ? (@ < $x.value)', '{"x": {"value" : 13}}');
|
||||
select * from jsonb_path_query('[10,11,12,13,14,15]', '$[0 to 2] ? (@ < $value)', '{"value" : 15}');
|
||||
select * from jsonb_path_query('[1,"1",2,"2",null]', '$[*] ? (@ == "1")');
|
||||
select * from jsonb_path_query('[1,"1",2,"2",null]', '$[*] ? (@ == $value)', '{"value" : "1"}');
|
||||
select * from jsonb_path_query('[1,"1",2,"2",null]', '$[*] ? (@ == $value)', '{"value" : null}');
|
||||
select * from jsonb_path_query('[1, "2", null]', '$[*] ? (@ != null)');
|
||||
select * from jsonb_path_query('[1, "2", null]', '$[*] ? (@ == null)');
|
||||
select * from jsonb_path_query('{}', '$ ? (@ == @)');
|
||||
select * from jsonb_path_query('[]', 'strict $ ? (@ == @)');
|
||||
|
||||
select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**');
|
||||
select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{0}');
|
||||
select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{0 to last}');
|
||||
select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{1}');
|
||||
select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{1 to last}');
|
||||
select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{2}');
|
||||
select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{2 to last}');
|
||||
select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{3 to last}');
|
||||
select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{last}');
|
||||
select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**.b ? (@ > 0)');
|
||||
select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{0}.b ? (@ > 0)');
|
||||
select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{1}.b ? (@ > 0)');
|
||||
select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{0 to last}.b ? (@ > 0)');
|
||||
select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{1 to last}.b ? (@ > 0)');
|
||||
select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{1 to 2}.b ? (@ > 0)');
|
||||
select jsonb_path_query('{"a": {"c": {"b": 1}}}', 'lax $.**.b ? (@ > 0)');
|
||||
select jsonb_path_query('{"a": {"c": {"b": 1}}}', 'lax $.**{0}.b ? (@ > 0)');
|
||||
select jsonb_path_query('{"a": {"c": {"b": 1}}}', 'lax $.**{1}.b ? (@ > 0)');
|
||||
select jsonb_path_query('{"a": {"c": {"b": 1}}}', 'lax $.**{0 to last}.b ? (@ > 0)');
|
||||
select jsonb_path_query('{"a": {"c": {"b": 1}}}', 'lax $.**{1 to last}.b ? (@ > 0)');
|
||||
select jsonb_path_query('{"a": {"c": {"b": 1}}}', 'lax $.**{1 to 2}.b ? (@ > 0)');
|
||||
select jsonb_path_query('{"a": {"c": {"b": 1}}}', 'lax $.**{2 to 3}.b ? (@ > 0)');
|
||||
|
||||
select jsonb '{"a": {"b": 1}}' @? '$.**.b ? ( @ > 0)';
|
||||
select jsonb '{"a": {"b": 1}}' @? '$.**{0}.b ? ( @ > 0)';
|
||||
select jsonb '{"a": {"b": 1}}' @? '$.**{1}.b ? ( @ > 0)';
|
||||
select jsonb '{"a": {"b": 1}}' @? '$.**{0 to last}.b ? ( @ > 0)';
|
||||
select jsonb '{"a": {"b": 1}}' @? '$.**{1 to last}.b ? ( @ > 0)';
|
||||
select jsonb '{"a": {"b": 1}}' @? '$.**{1 to 2}.b ? ( @ > 0)';
|
||||
select jsonb '{"a": {"c": {"b": 1}}}' @? '$.**.b ? ( @ > 0)';
|
||||
select jsonb '{"a": {"c": {"b": 1}}}' @? '$.**{0}.b ? ( @ > 0)';
|
||||
select jsonb '{"a": {"c": {"b": 1}}}' @? '$.**{1}.b ? ( @ > 0)';
|
||||
select jsonb '{"a": {"c": {"b": 1}}}' @? '$.**{0 to last}.b ? ( @ > 0)';
|
||||
select jsonb '{"a": {"c": {"b": 1}}}' @? '$.**{1 to last}.b ? ( @ > 0)';
|
||||
select jsonb '{"a": {"c": {"b": 1}}}' @? '$.**{1 to 2}.b ? ( @ > 0)';
|
||||
select jsonb '{"a": {"c": {"b": 1}}}' @? '$.**{2 to 3}.b ? ( @ > 0)';
|
||||
|
||||
select jsonb_path_query('{"g": {"x": 2}}', '$.g ? (exists (@.x))');
|
||||
select jsonb_path_query('{"g": {"x": 2}}', '$.g ? (exists (@.y))');
|
||||
select jsonb_path_query('{"g": {"x": 2}}', '$.g ? (exists (@.x ? (@ >= 2) ))');
|
||||
select jsonb_path_query('{"g": [{"x": 2}, {"y": 3}]}', 'lax $.g ? (exists (@.x))');
|
||||
select jsonb_path_query('{"g": [{"x": 2}, {"y": 3}]}', 'lax $.g ? (exists (@.x + "3"))');
|
||||
select jsonb_path_query('{"g": [{"x": 2}, {"y": 3}]}', 'lax $.g ? ((exists (@.x + "3")) is unknown)');
|
||||
select jsonb_path_query('{"g": [{"x": 2}, {"y": 3}]}', 'strict $.g[*] ? (exists (@.x))');
|
||||
select jsonb_path_query('{"g": [{"x": 2}, {"y": 3}]}', 'strict $.g[*] ? ((exists (@.x)) is unknown)');
|
||||
select jsonb_path_query('{"g": [{"x": 2}, {"y": 3}]}', 'strict $.g ? (exists (@[*].x))');
|
||||
select jsonb_path_query('{"g": [{"x": 2}, {"y": 3}]}', 'strict $.g ? ((exists (@[*].x)) is unknown)');
|
||||
|
||||
--test ternary logic
|
||||
select
|
||||
x, y,
|
||||
jsonb_path_query(
|
||||
'[true, false, null]',
|
||||
'$[*] ? (@ == true && ($x == true && $y == true) ||
|
||||
@ == false && !($x == true && $y == true) ||
|
||||
@ == null && ($x == true && $y == true) is unknown)',
|
||||
jsonb_build_object('x', x, 'y', y)
|
||||
) as "x && y"
|
||||
from
|
||||
(values (jsonb 'true'), ('false'), ('"null"')) x(x),
|
||||
(values (jsonb 'true'), ('false'), ('"null"')) y(y);
|
||||
|
||||
select
|
||||
x, y,
|
||||
jsonb_path_query(
|
||||
'[true, false, null]',
|
||||
'$[*] ? (@ == true && ($x == true || $y == true) ||
|
||||
@ == false && !($x == true || $y == true) ||
|
||||
@ == null && ($x == true || $y == true) is unknown)',
|
||||
jsonb_build_object('x', x, 'y', y)
|
||||
) as "x || y"
|
||||
from
|
||||
(values (jsonb 'true'), ('false'), ('"null"')) x(x),
|
||||
(values (jsonb 'true'), ('false'), ('"null"')) y(y);
|
||||
|
||||
select jsonb '{"a": 1, "b":1}' @? '$ ? (@.a == @.b)';
|
||||
select jsonb '{"c": {"a": 1, "b":1}}' @? '$ ? (@.a == @.b)';
|
||||
select jsonb '{"c": {"a": 1, "b":1}}' @? '$.c ? (@.a == @.b)';
|
||||
select jsonb '{"c": {"a": 1, "b":1}}' @? '$.c ? ($.c.a == @.b)';
|
||||
select jsonb '{"c": {"a": 1, "b":1}}' @? '$.* ? (@.a == @.b)';
|
||||
select jsonb '{"a": 1, "b":1}' @? '$.** ? (@.a == @.b)';
|
||||
select jsonb '{"c": {"a": 1, "b":1}}' @? '$.** ? (@.a == @.b)';
|
||||
|
||||
select jsonb_path_query('{"c": {"a": 2, "b":1}}', '$.** ? (@.a == 1 + 1)');
|
||||
select jsonb_path_query('{"c": {"a": 2, "b":1}}', '$.** ? (@.a == (1 + 1))');
|
||||
select jsonb_path_query('{"c": {"a": 2, "b":1}}', '$.** ? (@.a == @.b + 1)');
|
||||
select jsonb_path_query('{"c": {"a": 2, "b":1}}', '$.** ? (@.a == (@.b + 1))');
|
||||
select jsonb '{"c": {"a": -1, "b":1}}' @? '$.** ? (@.a == - 1)';
|
||||
select jsonb '{"c": {"a": -1, "b":1}}' @? '$.** ? (@.a == -1)';
|
||||
select jsonb '{"c": {"a": -1, "b":1}}' @? '$.** ? (@.a == -@.b)';
|
||||
select jsonb '{"c": {"a": -1, "b":1}}' @? '$.** ? (@.a == - @.b)';
|
||||
select jsonb '{"c": {"a": 0, "b":1}}' @? '$.** ? (@.a == 1 - @.b)';
|
||||
select jsonb '{"c": {"a": 2, "b":1}}' @? '$.** ? (@.a == 1 - - @.b)';
|
||||
select jsonb '{"c": {"a": 0, "b":1}}' @? '$.** ? (@.a == 1 - +@.b)';
|
||||
select jsonb '[1,2,3]' @? '$ ? (+@[*] > +2)';
|
||||
select jsonb '[1,2,3]' @? '$ ? (+@[*] > +3)';
|
||||
select jsonb '[1,2,3]' @? '$ ? (-@[*] < -2)';
|
||||
select jsonb '[1,2,3]' @? '$ ? (-@[*] < -3)';
|
||||
select jsonb '1' @? '$ ? ($ > 0)';
|
||||
|
||||
-- arithmetic errors
|
||||
select jsonb_path_query('[1,2,0,3]', '$[*] ? (2 / @ > 0)');
|
||||
select jsonb_path_query('[1,2,0,3]', '$[*] ? ((2 / @ > 0) is unknown)');
|
||||
select jsonb_path_query('0', '1 / $');
|
||||
select jsonb_path_query('0', '1 / $ + 2');
|
||||
select jsonb_path_query('0', '-(3 + 1 % $)');
|
||||
select jsonb_path_query('1', '$ + "2"');
|
||||
select jsonb_path_query('[1, 2]', '3 * $');
|
||||
select jsonb_path_query('"a"', '-$');
|
||||
select jsonb_path_query('[1,"2",3]', '+$');
|
||||
select jsonb_path_query('1', '$ + "2"', silent => true);
|
||||
select jsonb_path_query('[1, 2]', '3 * $', silent => true);
|
||||
select jsonb_path_query('"a"', '-$', silent => true);
|
||||
select jsonb_path_query('[1,"2",3]', '+$', silent => true);
|
||||
select jsonb '["1",2,0,3]' @? '-$[*]';
|
||||
select jsonb '[1,"2",0,3]' @? '-$[*]';
|
||||
select jsonb '["1",2,0,3]' @? 'strict -$[*]';
|
||||
select jsonb '[1,"2",0,3]' @? 'strict -$[*]';
|
||||
|
||||
-- unwrapping of operator arguments in lax mode
|
||||
select jsonb_path_query('{"a": [2]}', 'lax $.a * 3');
|
||||
select jsonb_path_query('{"a": [2]}', 'lax $.a + 3');
|
||||
select jsonb_path_query('{"a": [2, 3, 4]}', 'lax -$.a');
|
||||
-- should fail
|
||||
select jsonb_path_query('{"a": [1, 2]}', 'lax $.a * 3');
|
||||
select jsonb_path_query('{"a": [1, 2]}', 'lax $.a * 3', silent => true);
|
||||
|
||||
-- extension: boolean expressions
|
||||
select jsonb_path_query('2', '$ > 1');
|
||||
select jsonb_path_query('2', '$ <= 1');
|
||||
select jsonb_path_query('2', '$ == "2"');
|
||||
select jsonb '2' @? '$ == "2"';
|
||||
|
||||
select jsonb '2' @@ '$ > 1';
|
||||
select jsonb '2' @@ '$ <= 1';
|
||||
select jsonb '2' @@ '$ == "2"';
|
||||
select jsonb '2' @@ '1';
|
||||
select jsonb '{}' @@ '$';
|
||||
select jsonb '[]' @@ '$';
|
||||
select jsonb '[1,2,3]' @@ '$[*]';
|
||||
select jsonb '[]' @@ '$[*]';
|
||||
select jsonb_path_match('[[1, true], [2, false]]', 'strict $[*] ? (@[0] > $x) [1]', '{"x": 1}');
|
||||
select jsonb_path_match('[[1, true], [2, false]]', 'strict $[*] ? (@[0] < $x) [1]', '{"x": 2}');
|
||||
|
||||
select jsonb_path_match('[{"a": 1}, {"a": 2}, 3]', 'lax exists($[*].a)', silent => false);
|
||||
select jsonb_path_match('[{"a": 1}, {"a": 2}, 3]', 'lax exists($[*].a)', silent => true);
|
||||
select jsonb_path_match('[{"a": 1}, {"a": 2}, 3]', 'strict exists($[*].a)', silent => false);
|
||||
select jsonb_path_match('[{"a": 1}, {"a": 2}, 3]', 'strict exists($[*].a)', silent => true);
|
||||
|
||||
|
||||
select jsonb_path_query('[null,1,true,"a",[],{}]', '$.type()');
|
||||
select jsonb_path_query('[null,1,true,"a",[],{}]', 'lax $.type()');
|
||||
select jsonb_path_query('[null,1,true,"a",[],{}]', '$[*].type()');
|
||||
select jsonb_path_query('null', 'null.type()');
|
||||
select jsonb_path_query('null', 'true.type()');
|
||||
select jsonb_path_query('null', '123.type()');
|
||||
select jsonb_path_query('null', '"123".type()');
|
||||
|
||||
select jsonb_path_query('{"a": 2}', '($.a - 5).abs() + 10');
|
||||
select jsonb_path_query('{"a": 2.5}', '-($.a * $.a).floor() % 4.3');
|
||||
select jsonb_path_query('[1, 2, 3]', '($[*] > 2) ? (@ == true)');
|
||||
select jsonb_path_query('[1, 2, 3]', '($[*] > 3).type()');
|
||||
select jsonb_path_query('[1, 2, 3]', '($[*].a > 3).type()');
|
||||
select jsonb_path_query('[1, 2, 3]', 'strict ($[*].a > 3).type()');
|
||||
|
||||
select jsonb_path_query('[1,null,true,"11",[],[1],[1,2,3],{},{"a":1,"b":2}]', 'strict $[*].size()');
|
||||
select jsonb_path_query('[1,null,true,"11",[],[1],[1,2,3],{},{"a":1,"b":2}]', 'strict $[*].size()', silent => true);
|
||||
select jsonb_path_query('[1,null,true,"11",[],[1],[1,2,3],{},{"a":1,"b":2}]', 'lax $[*].size()');
|
||||
|
||||
select jsonb_path_query('[0, 1, -2, -3.4, 5.6]', '$[*].abs()');
|
||||
select jsonb_path_query('[0, 1, -2, -3.4, 5.6]', '$[*].floor()');
|
||||
select jsonb_path_query('[0, 1, -2, -3.4, 5.6]', '$[*].ceiling()');
|
||||
select jsonb_path_query('[0, 1, -2, -3.4, 5.6]', '$[*].ceiling().abs()');
|
||||
select jsonb_path_query('[0, 1, -2, -3.4, 5.6]', '$[*].ceiling().abs().type()');
|
||||
|
||||
select jsonb_path_query('[{},1]', '$[*].keyvalue()');
|
||||
select jsonb_path_query('[{},1]', '$[*].keyvalue()', silent => true);
|
||||
select jsonb_path_query('{}', '$.keyvalue()');
|
||||
select jsonb_path_query('{"a": 1, "b": [1, 2], "c": {"a": "bbb"}}', '$.keyvalue()');
|
||||
select jsonb_path_query('[{"a": 1, "b": [1, 2]}, {"c": {"a": "bbb"}}]', '$[*].keyvalue()');
|
||||
select jsonb_path_query('[{"a": 1, "b": [1, 2]}, {"c": {"a": "bbb"}}]', 'strict $.keyvalue()');
|
||||
select jsonb_path_query('[{"a": 1, "b": [1, 2]}, {"c": {"a": "bbb"}}]', 'lax $.keyvalue()');
|
||||
select jsonb_path_query('[{"a": 1, "b": [1, 2]}, {"c": {"a": "bbb"}}]', 'strict $.keyvalue().a');
|
||||
select jsonb '{"a": 1, "b": [1, 2]}' @? 'lax $.keyvalue()';
|
||||
select jsonb '{"a": 1, "b": [1, 2]}' @? 'lax $.keyvalue().key';
|
||||
|
||||
select jsonb_path_query('null', '$.double()');
|
||||
select jsonb_path_query('true', '$.double()');
|
||||
select jsonb_path_query('null', '$.double()', silent => true);
|
||||
select jsonb_path_query('true', '$.double()', silent => true);
|
||||
select jsonb_path_query('[]', '$.double()');
|
||||
select jsonb_path_query('[]', 'strict $.double()');
|
||||
select jsonb_path_query('{}', '$.double()');
|
||||
select jsonb_path_query('[]', 'strict $.double()', silent => true);
|
||||
select jsonb_path_query('{}', '$.double()', silent => true);
|
||||
select jsonb_path_query('1.23', '$.double()');
|
||||
select jsonb_path_query('"1.23"', '$.double()');
|
||||
select jsonb_path_query('"1.23aaa"', '$.double()');
|
||||
select jsonb_path_query('"nan"', '$.double()');
|
||||
select jsonb_path_query('"NaN"', '$.double()');
|
||||
select jsonb_path_query('"inf"', '$.double()');
|
||||
select jsonb_path_query('"-inf"', '$.double()');
|
||||
select jsonb_path_query('"inf"', '$.double()', silent => true);
|
||||
select jsonb_path_query('"-inf"', '$.double()', silent => true);
|
||||
|
||||
select jsonb_path_query('{}', '$.abs()');
|
||||
select jsonb_path_query('true', '$.floor()');
|
||||
select jsonb_path_query('"1.2"', '$.ceiling()');
|
||||
select jsonb_path_query('{}', '$.abs()', silent => true);
|
||||
select jsonb_path_query('true', '$.floor()', silent => true);
|
||||
select jsonb_path_query('"1.2"', '$.ceiling()', silent => true);
|
||||
|
||||
select jsonb_path_query('["", "a", "abc", "abcabc"]', '$[*] ? (@ starts with "abc")');
|
||||
select jsonb_path_query('["", "a", "abc", "abcabc"]', 'strict $ ? (@[*] starts with "abc")');
|
||||
select jsonb_path_query('["", "a", "abd", "abdabc"]', 'strict $ ? (@[*] starts with "abc")');
|
||||
select jsonb_path_query('["abc", "abcabc", null, 1]', 'strict $ ? (@[*] starts with "abc")');
|
||||
select jsonb_path_query('["abc", "abcabc", null, 1]', 'strict $ ? ((@[*] starts with "abc") is unknown)');
|
||||
select jsonb_path_query('[[null, 1, "abc", "abcabc"]]', 'lax $ ? (@[*] starts with "abc")');
|
||||
select jsonb_path_query('[[null, 1, "abd", "abdabc"]]', 'lax $ ? ((@[*] starts with "abc") is unknown)');
|
||||
select jsonb_path_query('[null, 1, "abd", "abdabc"]', 'lax $[*] ? ((@ starts with "abc") is unknown)');
|
||||
|
||||
select jsonb_path_query('[null, 1, "abc", "abd", "aBdC", "abdacb", "adc\nabc", "babc"]', 'lax $[*] ? (@ like_regex "^ab.*c")');
|
||||
select jsonb_path_query('[null, 1, "abc", "abd", "aBdC", "abdacb", "adc\nabc", "babc"]', 'lax $[*] ? (@ like_regex "^a b.* c " flag "ix")');
|
||||
select jsonb_path_query('[null, 1, "abc", "abd", "aBdC", "abdacb", "adc\nabc", "babc"]', 'lax $[*] ? (@ like_regex "^ab.*c" flag "m")');
|
||||
select jsonb_path_query('[null, 1, "abc", "abd", "aBdC", "abdacb", "adc\nabc", "babc"]', 'lax $[*] ? (@ like_regex "^ab.*c" flag "s")');
|
||||
|
||||
-- jsonpath operators
|
||||
|
||||
SELECT jsonb_path_query('[{"a": 1}, {"a": 2}]', '$[*]');
|
||||
SELECT jsonb_path_query('[{"a": 1}, {"a": 2}]', '$[*] ? (@.a > 10)');
|
||||
|
||||
SELECT jsonb_path_query_array('[{"a": 1}, {"a": 2}, {}]', 'strict $[*].a');
|
||||
SELECT jsonb_path_query_array('[{"a": 1}, {"a": 2}]', '$[*].a');
|
||||
SELECT jsonb_path_query_array('[{"a": 1}, {"a": 2}]', '$[*].a ? (@ == 1)');
|
||||
SELECT jsonb_path_query_array('[{"a": 1}, {"a": 2}]', '$[*].a ? (@ > 10)');
|
||||
SELECT jsonb_path_query_array('[{"a": 1}, {"a": 2}, {"a": 3}, {"a": 5}]', '$[*].a ? (@ > $min && @ < $max)', vars => '{"min": 1, "max": 4}');
|
||||
SELECT jsonb_path_query_array('[{"a": 1}, {"a": 2}, {"a": 3}, {"a": 5}]', '$[*].a ? (@ > $min && @ < $max)', vars => '{"min": 3, "max": 4}');
|
||||
|
||||
SELECT jsonb_path_query_first('[{"a": 1}, {"a": 2}, {}]', 'strict $[*].a');
|
||||
SELECT jsonb_path_query_first('[{"a": 1}, {"a": 2}, {}]', 'strict $[*].a', silent => true);
|
||||
SELECT jsonb_path_query_first('[{"a": 1}, {"a": 2}]', '$[*].a');
|
||||
SELECT jsonb_path_query_first('[{"a": 1}, {"a": 2}]', '$[*].a ? (@ == 1)');
|
||||
SELECT jsonb_path_query_first('[{"a": 1}, {"a": 2}]', '$[*].a ? (@ > 10)');
|
||||
SELECT jsonb_path_query_first('[{"a": 1}, {"a": 2}, {"a": 3}, {"a": 5}]', '$[*].a ? (@ > $min && @ < $max)', vars => '{"min": 1, "max": 4}');
|
||||
SELECT jsonb_path_query_first('[{"a": 1}, {"a": 2}, {"a": 3}, {"a": 5}]', '$[*].a ? (@ > $min && @ < $max)', vars => '{"min": 3, "max": 4}');
|
||||
|
||||
SELECT jsonb '[{"a": 1}, {"a": 2}]' @? '$[*].a ? (@ > 1)';
|
||||
SELECT jsonb '[{"a": 1}, {"a": 2}]' @? '$[*] ? (@.a > 2)';
|
||||
SELECT jsonb_path_exists('[{"a": 1}, {"a": 2}, {"a": 3}, {"a": 5}]', '$[*] ? (@.a > $min && @.a < $max)', vars => '{"min": 1, "max": 4}');
|
||||
SELECT jsonb_path_exists('[{"a": 1}, {"a": 2}, {"a": 3}, {"a": 5}]', '$[*] ? (@.a > $min && @.a < $max)', vars => '{"min": 3, "max": 4}');
|
||||
|
||||
SELECT jsonb '[{"a": 1}, {"a": 2}]' @@ '$[*].a > 1';
|
||||
SELECT jsonb '[{"a": 1}, {"a": 2}]' @@ '$[*].a > 2';
|
||||
147
src/test/regress/sql/jsonpath.sql
Normal file
147
src/test/regress/sql/jsonpath.sql
Normal file
@@ -0,0 +1,147 @@
|
||||
--jsonpath io
|
||||
|
||||
select ''::jsonpath;
|
||||
select '$'::jsonpath;
|
||||
select 'strict $'::jsonpath;
|
||||
select 'lax $'::jsonpath;
|
||||
select '$.a'::jsonpath;
|
||||
select '$.a.v'::jsonpath;
|
||||
select '$.a.*'::jsonpath;
|
||||
select '$.*[*]'::jsonpath;
|
||||
select '$.a[*]'::jsonpath;
|
||||
select '$.a[*][*]'::jsonpath;
|
||||
select '$[*]'::jsonpath;
|
||||
select '$[0]'::jsonpath;
|
||||
select '$[*][0]'::jsonpath;
|
||||
select '$[*].a'::jsonpath;
|
||||
select '$[*][0].a.b'::jsonpath;
|
||||
select '$.a.**.b'::jsonpath;
|
||||
select '$.a.**{2}.b'::jsonpath;
|
||||
select '$.a.**{2 to 2}.b'::jsonpath;
|
||||
select '$.a.**{2 to 5}.b'::jsonpath;
|
||||
select '$.a.**{0 to 5}.b'::jsonpath;
|
||||
select '$.a.**{5 to last}.b'::jsonpath;
|
||||
select '$.a.**{last}.b'::jsonpath;
|
||||
select '$.a.**{last to 5}.b'::jsonpath;
|
||||
select '$+1'::jsonpath;
|
||||
select '$-1'::jsonpath;
|
||||
select '$--+1'::jsonpath;
|
||||
select '$.a/+-1'::jsonpath;
|
||||
select '1 * 2 + 4 % -3 != false'::jsonpath;
|
||||
|
||||
select '"\b\f\r\n\t\v\"\''\\"'::jsonpath;
|
||||
select '''\b\f\r\n\t\v\"\''\\'''::jsonpath;
|
||||
select '"\x50\u0067\u{53}\u{051}\u{00004C}"'::jsonpath;
|
||||
select '''\x50\u0067\u{53}\u{051}\u{00004C}'''::jsonpath;
|
||||
select '$.foo\x50\u0067\u{53}\u{051}\u{00004C}\t\"bar'::jsonpath;
|
||||
|
||||
select '$.g ? ($.a == 1)'::jsonpath;
|
||||
select '$.g ? (@ == 1)'::jsonpath;
|
||||
select '$.g ? (@.a == 1)'::jsonpath;
|
||||
select '$.g ? (@.a == 1 || @.a == 4)'::jsonpath;
|
||||
select '$.g ? (@.a == 1 && @.a == 4)'::jsonpath;
|
||||
select '$.g ? (@.a == 1 || @.a == 4 && @.b == 7)'::jsonpath;
|
||||
select '$.g ? (@.a == 1 || !(@.a == 4) && @.b == 7)'::jsonpath;
|
||||
select '$.g ? (@.a == 1 || !(@.x >= 123 || @.a == 4) && @.b == 7)'::jsonpath;
|
||||
select '$.g ? (@.x >= @[*]?(@.a > "abc"))'::jsonpath;
|
||||
select '$.g ? ((@.x >= 123 || @.a == 4) is unknown)'::jsonpath;
|
||||
select '$.g ? (exists (@.x))'::jsonpath;
|
||||
select '$.g ? (exists (@.x ? (@ == 14)))'::jsonpath;
|
||||
select '$.g ? ((@.x >= 123 || @.a == 4) && exists (@.x ? (@ == 14)))'::jsonpath;
|
||||
select '$.g ? (+@.x >= +-(+@.a + 2))'::jsonpath;
|
||||
|
||||
select '$a'::jsonpath;
|
||||
select '$a.b'::jsonpath;
|
||||
select '$a[*]'::jsonpath;
|
||||
select '$.g ? (@.zip == $zip)'::jsonpath;
|
||||
select '$.a[1,2, 3 to 16]'::jsonpath;
|
||||
select '$.a[$a + 1, ($b[*]) to -($[0] * 2)]'::jsonpath;
|
||||
select '$.a[$.a.size() - 3]'::jsonpath;
|
||||
select 'last'::jsonpath;
|
||||
select '"last"'::jsonpath;
|
||||
select '$.last'::jsonpath;
|
||||
select '$ ? (last > 0)'::jsonpath;
|
||||
select '$[last]'::jsonpath;
|
||||
select '$[$[0] ? (last > 0)]'::jsonpath;
|
||||
|
||||
select 'null.type()'::jsonpath;
|
||||
select '1.type()'::jsonpath;
|
||||
select '"aaa".type()'::jsonpath;
|
||||
select 'true.type()'::jsonpath;
|
||||
select '$.double().floor().ceiling().abs()'::jsonpath;
|
||||
select '$.keyvalue().key'::jsonpath;
|
||||
|
||||
select '$ ? (@ starts with "abc")'::jsonpath;
|
||||
select '$ ? (@ starts with $var)'::jsonpath;
|
||||
|
||||
select '$ ? (@ like_regex "(invalid pattern")'::jsonpath;
|
||||
select '$ ? (@ like_regex "pattern")'::jsonpath;
|
||||
select '$ ? (@ like_regex "pattern" flag "")'::jsonpath;
|
||||
select '$ ? (@ like_regex "pattern" flag "i")'::jsonpath;
|
||||
select '$ ? (@ like_regex "pattern" flag "is")'::jsonpath;
|
||||
select '$ ? (@ like_regex "pattern" flag "isim")'::jsonpath;
|
||||
select '$ ? (@ like_regex "pattern" flag "xsms")'::jsonpath;
|
||||
select '$ ? (@ like_regex "pattern" flag "a")'::jsonpath;
|
||||
|
||||
select '$ < 1'::jsonpath;
|
||||
select '($ < 1) || $.a.b <= $x'::jsonpath;
|
||||
select '@ + 1'::jsonpath;
|
||||
|
||||
select '($).a.b'::jsonpath;
|
||||
select '($.a.b).c.d'::jsonpath;
|
||||
select '($.a.b + -$.x.y).c.d'::jsonpath;
|
||||
select '(-+$.a.b).c.d'::jsonpath;
|
||||
select '1 + ($.a.b + 2).c.d'::jsonpath;
|
||||
select '1 + ($.a.b > 2).c.d'::jsonpath;
|
||||
select '($)'::jsonpath;
|
||||
select '(($))'::jsonpath;
|
||||
select '((($ + 1)).a + ((2)).b ? ((((@ > 1)) || (exists(@.c)))))'::jsonpath;
|
||||
|
||||
select '$ ? (@.a < 1)'::jsonpath;
|
||||
select '$ ? (@.a < -1)'::jsonpath;
|
||||
select '$ ? (@.a < +1)'::jsonpath;
|
||||
select '$ ? (@.a < .1)'::jsonpath;
|
||||
select '$ ? (@.a < -.1)'::jsonpath;
|
||||
select '$ ? (@.a < +.1)'::jsonpath;
|
||||
select '$ ? (@.a < 0.1)'::jsonpath;
|
||||
select '$ ? (@.a < -0.1)'::jsonpath;
|
||||
select '$ ? (@.a < +0.1)'::jsonpath;
|
||||
select '$ ? (@.a < 10.1)'::jsonpath;
|
||||
select '$ ? (@.a < -10.1)'::jsonpath;
|
||||
select '$ ? (@.a < +10.1)'::jsonpath;
|
||||
select '$ ? (@.a < 1e1)'::jsonpath;
|
||||
select '$ ? (@.a < -1e1)'::jsonpath;
|
||||
select '$ ? (@.a < +1e1)'::jsonpath;
|
||||
select '$ ? (@.a < .1e1)'::jsonpath;
|
||||
select '$ ? (@.a < -.1e1)'::jsonpath;
|
||||
select '$ ? (@.a < +.1e1)'::jsonpath;
|
||||
select '$ ? (@.a < 0.1e1)'::jsonpath;
|
||||
select '$ ? (@.a < -0.1e1)'::jsonpath;
|
||||
select '$ ? (@.a < +0.1e1)'::jsonpath;
|
||||
select '$ ? (@.a < 10.1e1)'::jsonpath;
|
||||
select '$ ? (@.a < -10.1e1)'::jsonpath;
|
||||
select '$ ? (@.a < +10.1e1)'::jsonpath;
|
||||
select '$ ? (@.a < 1e-1)'::jsonpath;
|
||||
select '$ ? (@.a < -1e-1)'::jsonpath;
|
||||
select '$ ? (@.a < +1e-1)'::jsonpath;
|
||||
select '$ ? (@.a < .1e-1)'::jsonpath;
|
||||
select '$ ? (@.a < -.1e-1)'::jsonpath;
|
||||
select '$ ? (@.a < +.1e-1)'::jsonpath;
|
||||
select '$ ? (@.a < 0.1e-1)'::jsonpath;
|
||||
select '$ ? (@.a < -0.1e-1)'::jsonpath;
|
||||
select '$ ? (@.a < +0.1e-1)'::jsonpath;
|
||||
select '$ ? (@.a < 10.1e-1)'::jsonpath;
|
||||
select '$ ? (@.a < -10.1e-1)'::jsonpath;
|
||||
select '$ ? (@.a < +10.1e-1)'::jsonpath;
|
||||
select '$ ? (@.a < 1e+1)'::jsonpath;
|
||||
select '$ ? (@.a < -1e+1)'::jsonpath;
|
||||
select '$ ? (@.a < +1e+1)'::jsonpath;
|
||||
select '$ ? (@.a < .1e+1)'::jsonpath;
|
||||
select '$ ? (@.a < -.1e+1)'::jsonpath;
|
||||
select '$ ? (@.a < +.1e+1)'::jsonpath;
|
||||
select '$ ? (@.a < 0.1e+1)'::jsonpath;
|
||||
select '$ ? (@.a < -0.1e+1)'::jsonpath;
|
||||
select '$ ? (@.a < +0.1e+1)'::jsonpath;
|
||||
select '$ ? (@.a < 10.1e+1)'::jsonpath;
|
||||
select '$ ? (@.a < -10.1e+1)'::jsonpath;
|
||||
select '$ ? (@.a < +10.1e+1)'::jsonpath;
|
||||
Reference in New Issue
Block a user