summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/expected/jsonpath.out18
-rw-r--r--src/test/regress/sql/jsonpath.sql11
2 files changed, 29 insertions, 0 deletions
diff --git a/src/test/regress/expected/jsonpath.out b/src/test/regress/expected/jsonpath.out
index fdaac58367a..ca0cdf1ab2c 100644
--- a/src/test/regress/expected/jsonpath.out
+++ b/src/test/regress/expected/jsonpath.out
@@ -1032,3 +1032,21 @@ select '1?(2>3)'::jsonpath;
(1)?(2 > 3)
(1 row)
+-- test non-error-throwing API
+SELECT str as jsonpath,
+ pg_input_is_valid(str,'jsonpath') as ok,
+ pg_input_error_message(str,'jsonpath') as errmsg
+FROM unnest(ARRAY['$ ? (@ like_regex "pattern" flag "smixq")'::text,
+ '$ ? (@ like_regex "pattern" flag "a")',
+ '@ + 1',
+ '00',
+ '1a']) str;
+ jsonpath | ok | errmsg
+-------------------------------------------+----+-----------------------------------------------------------------------
+ $ ? (@ like_regex "pattern" flag "smixq") | t |
+ $ ? (@ like_regex "pattern" flag "a") | f | invalid input syntax for type jsonpath
+ @ + 1 | f | @ is not allowed in root expressions
+ 00 | f | trailing junk after numeric literal at or near "00" of jsonpath input
+ 1a | f | trailing junk after numeric literal at or near "1a" of jsonpath input
+(5 rows)
+
diff --git a/src/test/regress/sql/jsonpath.sql b/src/test/regress/sql/jsonpath.sql
index d491714614a..99d21d2af78 100644
--- a/src/test/regress/sql/jsonpath.sql
+++ b/src/test/regress/sql/jsonpath.sql
@@ -187,3 +187,14 @@ select '1..e3'::jsonpath;
select '(1.).e'::jsonpath;
select '(1.).e3'::jsonpath;
select '1?(2>3)'::jsonpath;
+
+-- test non-error-throwing API
+
+SELECT str as jsonpath,
+ pg_input_is_valid(str,'jsonpath') as ok,
+ pg_input_error_message(str,'jsonpath') as errmsg
+FROM unnest(ARRAY['$ ? (@ like_regex "pattern" flag "smixq")'::text,
+ '$ ? (@ like_regex "pattern" flag "a")',
+ '@ + 1',
+ '00',
+ '1a']) str;