Restrict some cases in parsing numerics in jsonpath
Jsonpath now accepts integers with leading zeroes and floats starting with a dot. However, SQL standard requires to follow JSON specification, which doesn't allow none of these cases. Our json[b] datatypes also restrict that. So, restrict it in jsonpath altogether. Author: Nikita Glukhov
This commit is contained in:
parent
0a02e2ae02
commit
2e643501e5
|
@ -80,9 +80,9 @@ any [^\?\%\$\.\[\]\{\}\(\)\|\&\!\=\<\>\@\#\,\*:\-\+\/\\\"\' \t\n\r\f]
|
||||||
blank [ \t\n\r\f]
|
blank [ \t\n\r\f]
|
||||||
|
|
||||||
digit [0-9]
|
digit [0-9]
|
||||||
integer {digit}+
|
integer (0|[1-9]{digit}*)
|
||||||
decimal {digit}*\.{digit}+
|
decimal {integer}\.{digit}+
|
||||||
decimalfail {digit}+\.
|
decimalfail {integer}\.
|
||||||
real ({integer}|{decimal})[Ee][-+]?{digit}+
|
real ({integer}|{decimal})[Ee][-+]?{digit}+
|
||||||
realfail1 ({integer}|{decimal})[Ee]
|
realfail1 ({integer}|{decimal})[Ee]
|
||||||
realfail2 ({integer}|{decimal})[Ee][-+]
|
realfail2 ({integer}|{decimal})[Ee][-+]
|
||||||
|
|
|
@ -547,23 +547,20 @@ select '$ ? (@.a < +1)'::jsonpath;
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
select '$ ? (@.a < .1)'::jsonpath;
|
select '$ ? (@.a < .1)'::jsonpath;
|
||||||
jsonpath
|
ERROR: bad jsonpath representation
|
||||||
-----------------
|
LINE 1: select '$ ? (@.a < .1)'::jsonpath;
|
||||||
$?(@."a" < 0.1)
|
^
|
||||||
(1 row)
|
DETAIL: syntax error, unexpected '.' at or near "."
|
||||||
|
|
||||||
select '$ ? (@.a < -.1)'::jsonpath;
|
select '$ ? (@.a < -.1)'::jsonpath;
|
||||||
jsonpath
|
ERROR: bad jsonpath representation
|
||||||
------------------
|
LINE 1: select '$ ? (@.a < -.1)'::jsonpath;
|
||||||
$?(@."a" < -0.1)
|
^
|
||||||
(1 row)
|
DETAIL: syntax error, unexpected '.' at or near "."
|
||||||
|
|
||||||
select '$ ? (@.a < +.1)'::jsonpath;
|
select '$ ? (@.a < +.1)'::jsonpath;
|
||||||
jsonpath
|
ERROR: bad jsonpath representation
|
||||||
-----------------
|
LINE 1: select '$ ? (@.a < +.1)'::jsonpath;
|
||||||
$?(@."a" < 0.1)
|
^
|
||||||
(1 row)
|
DETAIL: syntax error, unexpected '.' at or near "."
|
||||||
|
|
||||||
select '$ ? (@.a < 0.1)'::jsonpath;
|
select '$ ? (@.a < 0.1)'::jsonpath;
|
||||||
jsonpath
|
jsonpath
|
||||||
-----------------
|
-----------------
|
||||||
|
@ -619,23 +616,20 @@ select '$ ? (@.a < +1e1)'::jsonpath;
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
select '$ ? (@.a < .1e1)'::jsonpath;
|
select '$ ? (@.a < .1e1)'::jsonpath;
|
||||||
jsonpath
|
ERROR: bad jsonpath representation
|
||||||
---------------
|
LINE 1: select '$ ? (@.a < .1e1)'::jsonpath;
|
||||||
$?(@."a" < 1)
|
^
|
||||||
(1 row)
|
DETAIL: syntax error, unexpected '.' at or near "."
|
||||||
|
|
||||||
select '$ ? (@.a < -.1e1)'::jsonpath;
|
select '$ ? (@.a < -.1e1)'::jsonpath;
|
||||||
jsonpath
|
ERROR: bad jsonpath representation
|
||||||
----------------
|
LINE 1: select '$ ? (@.a < -.1e1)'::jsonpath;
|
||||||
$?(@."a" < -1)
|
^
|
||||||
(1 row)
|
DETAIL: syntax error, unexpected '.' at or near "."
|
||||||
|
|
||||||
select '$ ? (@.a < +.1e1)'::jsonpath;
|
select '$ ? (@.a < +.1e1)'::jsonpath;
|
||||||
jsonpath
|
ERROR: bad jsonpath representation
|
||||||
---------------
|
LINE 1: select '$ ? (@.a < +.1e1)'::jsonpath;
|
||||||
$?(@."a" < 1)
|
^
|
||||||
(1 row)
|
DETAIL: syntax error, unexpected '.' at or near "."
|
||||||
|
|
||||||
select '$ ? (@.a < 0.1e1)'::jsonpath;
|
select '$ ? (@.a < 0.1e1)'::jsonpath;
|
||||||
jsonpath
|
jsonpath
|
||||||
---------------
|
---------------
|
||||||
|
@ -691,23 +685,20 @@ select '$ ? (@.a < +1e-1)'::jsonpath;
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
select '$ ? (@.a < .1e-1)'::jsonpath;
|
select '$ ? (@.a < .1e-1)'::jsonpath;
|
||||||
jsonpath
|
ERROR: bad jsonpath representation
|
||||||
------------------
|
LINE 1: select '$ ? (@.a < .1e-1)'::jsonpath;
|
||||||
$?(@."a" < 0.01)
|
^
|
||||||
(1 row)
|
DETAIL: syntax error, unexpected '.' at or near "."
|
||||||
|
|
||||||
select '$ ? (@.a < -.1e-1)'::jsonpath;
|
select '$ ? (@.a < -.1e-1)'::jsonpath;
|
||||||
jsonpath
|
ERROR: bad jsonpath representation
|
||||||
-------------------
|
LINE 1: select '$ ? (@.a < -.1e-1)'::jsonpath;
|
||||||
$?(@."a" < -0.01)
|
^
|
||||||
(1 row)
|
DETAIL: syntax error, unexpected '.' at or near "."
|
||||||
|
|
||||||
select '$ ? (@.a < +.1e-1)'::jsonpath;
|
select '$ ? (@.a < +.1e-1)'::jsonpath;
|
||||||
jsonpath
|
ERROR: bad jsonpath representation
|
||||||
------------------
|
LINE 1: select '$ ? (@.a < +.1e-1)'::jsonpath;
|
||||||
$?(@."a" < 0.01)
|
^
|
||||||
(1 row)
|
DETAIL: syntax error, unexpected '.' at or near "."
|
||||||
|
|
||||||
select '$ ? (@.a < 0.1e-1)'::jsonpath;
|
select '$ ? (@.a < 0.1e-1)'::jsonpath;
|
||||||
jsonpath
|
jsonpath
|
||||||
------------------
|
------------------
|
||||||
|
@ -763,23 +754,20 @@ select '$ ? (@.a < +1e+1)'::jsonpath;
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
select '$ ? (@.a < .1e+1)'::jsonpath;
|
select '$ ? (@.a < .1e+1)'::jsonpath;
|
||||||
jsonpath
|
ERROR: bad jsonpath representation
|
||||||
---------------
|
LINE 1: select '$ ? (@.a < .1e+1)'::jsonpath;
|
||||||
$?(@."a" < 1)
|
^
|
||||||
(1 row)
|
DETAIL: syntax error, unexpected '.' at or near "."
|
||||||
|
|
||||||
select '$ ? (@.a < -.1e+1)'::jsonpath;
|
select '$ ? (@.a < -.1e+1)'::jsonpath;
|
||||||
jsonpath
|
ERROR: bad jsonpath representation
|
||||||
----------------
|
LINE 1: select '$ ? (@.a < -.1e+1)'::jsonpath;
|
||||||
$?(@."a" < -1)
|
^
|
||||||
(1 row)
|
DETAIL: syntax error, unexpected '.' at or near "."
|
||||||
|
|
||||||
select '$ ? (@.a < +.1e+1)'::jsonpath;
|
select '$ ? (@.a < +.1e+1)'::jsonpath;
|
||||||
jsonpath
|
ERROR: bad jsonpath representation
|
||||||
---------------
|
LINE 1: select '$ ? (@.a < +.1e+1)'::jsonpath;
|
||||||
$?(@."a" < 1)
|
^
|
||||||
(1 row)
|
DETAIL: syntax error, unexpected '.' at or near "."
|
||||||
|
|
||||||
select '$ ? (@.a < 0.1e+1)'::jsonpath;
|
select '$ ? (@.a < 0.1e+1)'::jsonpath;
|
||||||
jsonpath
|
jsonpath
|
||||||
---------------
|
---------------
|
||||||
|
@ -823,11 +811,10 @@ select '0'::jsonpath;
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
select '00'::jsonpath;
|
select '00'::jsonpath;
|
||||||
jsonpath
|
ERROR: bad jsonpath representation
|
||||||
----------
|
LINE 1: select '00'::jsonpath;
|
||||||
0
|
^
|
||||||
(1 row)
|
DETAIL: syntax error, unexpected IDENT_P at end of input
|
||||||
|
|
||||||
select '0.0'::jsonpath;
|
select '0.0'::jsonpath;
|
||||||
jsonpath
|
jsonpath
|
||||||
----------
|
----------
|
||||||
|
|
Loading…
Reference in New Issue