@ -836,6 +836,7 @@ select '$ ? (@.a < +10.1e+1)'::jsonpath;
$?(@."a" < 101)
(1 row)
-- numeric literals
select '0'::jsonpath;
jsonpath
----------
@ -846,6 +847,10 @@ select '00'::jsonpath;
ERROR: trailing junk after numeric literal at or near "00" of jsonpath input
LINE 1: select '00'::jsonpath;
^
select '0755'::jsonpath;
ERROR: syntax error at end of jsonpath input
LINE 1: select '0755'::jsonpath;
^
select '0.0'::jsonpath;
jsonpath
----------
@ -1032,6 +1037,163 @@ select '1?(2>3)'::jsonpath;
(1)?(2 > 3)
(1 row)
-- nondecimal
select '0b100101'::jsonpath;
jsonpath
----------
37
(1 row)
select '0o273'::jsonpath;
jsonpath
----------
187
(1 row)
select '0x42F'::jsonpath;
jsonpath
----------
1071
(1 row)
-- error cases
select '0b'::jsonpath;
ERROR: trailing junk after numeric literal at or near "0b" of jsonpath input
LINE 1: select '0b'::jsonpath;
^
select '1b'::jsonpath;
ERROR: trailing junk after numeric literal at or near "1b" of jsonpath input
LINE 1: select '1b'::jsonpath;
^
select '0b0x'::jsonpath;
ERROR: syntax error at end of jsonpath input
LINE 1: select '0b0x'::jsonpath;
^
select '0o'::jsonpath;
ERROR: trailing junk after numeric literal at or near "0o" of jsonpath input
LINE 1: select '0o'::jsonpath;
^
select '1o'::jsonpath;
ERROR: trailing junk after numeric literal at or near "1o" of jsonpath input
LINE 1: select '1o'::jsonpath;
^
select '0o0x'::jsonpath;
ERROR: syntax error at end of jsonpath input
LINE 1: select '0o0x'::jsonpath;
^
select '0x'::jsonpath;
ERROR: trailing junk after numeric literal at or near "0x" of jsonpath input
LINE 1: select '0x'::jsonpath;
^
select '1x'::jsonpath;
ERROR: trailing junk after numeric literal at or near "1x" of jsonpath input
LINE 1: select '1x'::jsonpath;
^
select '0x0y'::jsonpath;
ERROR: syntax error at end of jsonpath input
LINE 1: select '0x0y'::jsonpath;
^
-- underscores
select '1_000_000'::jsonpath;
jsonpath
----------
1000000
(1 row)
select '1_2_3'::jsonpath;
jsonpath
----------
123
(1 row)
select '0x1EEE_FFFF'::jsonpath;
jsonpath
-----------
518979583
(1 row)
select '0o2_73'::jsonpath;
jsonpath
----------
187
(1 row)
select '0b10_0101'::jsonpath;
jsonpath
----------
37
(1 row)
select '1_000.000_005'::jsonpath;
jsonpath
-------------
1000.000005
(1 row)
select '1_000.'::jsonpath;
jsonpath
----------
1000
(1 row)
select '.000_005'::jsonpath;
jsonpath
----------
0.000005
(1 row)
select '1_000.5e0_1'::jsonpath;
jsonpath
----------
10005
(1 row)
-- error cases
select '_100'::jsonpath;
ERROR: syntax error at end of jsonpath input
LINE 1: select '_100'::jsonpath;
^
select '100_'::jsonpath;
ERROR: trailing junk after numeric literal at or near "100_" of jsonpath input
LINE 1: select '100_'::jsonpath;
^
select '100__000'::jsonpath;
ERROR: syntax error at end of jsonpath input
LINE 1: select '100__000'::jsonpath;
^
select '_1_000.5'::jsonpath;
ERROR: syntax error at end of jsonpath input
LINE 1: select '_1_000.5'::jsonpath;
^
select '1_000_.5'::jsonpath;
ERROR: trailing junk after numeric literal at or near "1_000_" of jsonpath input
LINE 1: select '1_000_.5'::jsonpath;
^
select '1_000._5'::jsonpath;
ERROR: trailing junk after numeric literal at or near "1_000._" of jsonpath input
LINE 1: select '1_000._5'::jsonpath;
^
select '1_000.5_'::jsonpath;
ERROR: trailing junk after numeric literal at or near "1_000.5_" of jsonpath input
LINE 1: select '1_000.5_'::jsonpath;
^
select '1_000.5e_1'::jsonpath;
ERROR: trailing junk after numeric literal at or near "1_000.5e" of jsonpath input
LINE 1: select '1_000.5e_1'::jsonpath;
^
-- underscore after prefix not allowed in JavaScript (but allowed in SQL)
select '0b_10_0101'::jsonpath;
ERROR: syntax error at end of jsonpath input
LINE 1: select '0b_10_0101'::jsonpath;
^
select '0o_273'::jsonpath;
ERROR: syntax error at end of jsonpath input
LINE 1: select '0o_273'::jsonpath;
^
select '0x_42F'::jsonpath;
ERROR: syntax error at end of jsonpath input
LINE 1: select '0x_42F'::jsonpath;
^
-- test non-error-throwing API
SELECT str as jsonpath,
pg_input_is_valid(str,'jsonpath') as ok,