diff options
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/jsonb_jsonpath.out | 51 | ||||
| -rw-r--r-- | src/test/regress/sql/jsonb_jsonpath.sql | 12 |
2 files changed, 63 insertions, 0 deletions
diff --git a/src/test/regress/expected/jsonb_jsonpath.out b/src/test/regress/expected/jsonb_jsonpath.out index 4a84d9157fa..49a857bca62 100644 --- a/src/test/regress/expected/jsonb_jsonpath.out +++ b/src/test/regress/expected/jsonb_jsonpath.out @@ -1769,6 +1769,57 @@ SELECT jsonb_path_exists('[{"a": 1}, {"a": 2}, {"a": 3}, {"a": 5}]', '$[*] ? (@. f (1 row) +SELECT jsonb_path_match('true', '$', silent => false); + jsonb_path_match +------------------ + t +(1 row) + +SELECT jsonb_path_match('false', '$', silent => false); + jsonb_path_match +------------------ + f +(1 row) + +SELECT jsonb_path_match('null', '$', silent => false); + jsonb_path_match +------------------ + +(1 row) + +SELECT jsonb_path_match('1', '$', silent => true); + jsonb_path_match +------------------ + +(1 row) + +SELECT jsonb_path_match('1', '$', silent => false); +ERROR: singleton SQL/JSON item required +DETAIL: expression should return a singleton boolean +SELECT jsonb_path_match('"a"', '$', silent => false); +ERROR: singleton SQL/JSON item required +DETAIL: expression should return a singleton boolean +SELECT jsonb_path_match('{}', '$', silent => false); +ERROR: singleton SQL/JSON item required +DETAIL: expression should return a singleton boolean +SELECT jsonb_path_match('[true]', '$', silent => false); +ERROR: singleton SQL/JSON item required +DETAIL: expression should return a singleton boolean +SELECT jsonb_path_match('{}', 'lax $.a', silent => false); +ERROR: singleton SQL/JSON item required +DETAIL: expression should return a singleton boolean +SELECT jsonb_path_match('{}', 'strict $.a', silent => false); +ERROR: SQL/JSON member not found +DETAIL: JSON object does not contain key "a" +SELECT jsonb_path_match('{}', 'strict $.a', silent => true); + jsonb_path_match +------------------ + +(1 row) + +SELECT jsonb_path_match('[true, true]', '$[*]', silent => false); +ERROR: singleton SQL/JSON item required +DETAIL: expression should return a singleton boolean SELECT jsonb '[{"a": 1}, {"a": 2}]' @@ '$[*].a > 1'; ?column? ---------- diff --git a/src/test/regress/sql/jsonb_jsonpath.sql b/src/test/regress/sql/jsonb_jsonpath.sql index 28c861bb179..464ff94be37 100644 --- a/src/test/regress/sql/jsonb_jsonpath.sql +++ b/src/test/regress/sql/jsonb_jsonpath.sql @@ -366,6 +366,18 @@ SELECT jsonb_path_exists('[{"a": 1}, {"a": 2}]', '$[*].a ? (@ > 1)'); 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_path_match('true', '$', silent => false); +SELECT jsonb_path_match('false', '$', silent => false); +SELECT jsonb_path_match('null', '$', silent => false); +SELECT jsonb_path_match('1', '$', silent => true); +SELECT jsonb_path_match('1', '$', silent => false); +SELECT jsonb_path_match('"a"', '$', silent => false); +SELECT jsonb_path_match('{}', '$', silent => false); +SELECT jsonb_path_match('[true]', '$', silent => false); +SELECT jsonb_path_match('{}', 'lax $.a', silent => false); +SELECT jsonb_path_match('{}', 'strict $.a', silent => false); +SELECT jsonb_path_match('{}', 'strict $.a', silent => true); +SELECT jsonb_path_match('[true, true]', '$[*]', silent => false); SELECT jsonb '[{"a": 1}, {"a": 2}]' @@ '$[*].a > 1'; SELECT jsonb '[{"a": 1}, {"a": 2}]' @@ '$[*].a > 2'; SELECT jsonb_path_match('[{"a": 1}, {"a": 2}]', '$[*].a > 1'); |
