diff options
| author | Alexander Korotkov | 2019-03-16 09:21:19 +0000 |
|---|---|---|
| committer | Alexander Korotkov | 2019-03-16 09:21:19 +0000 |
| commit | 16d489b0fe058e527619f5e9d92fd7ca3c6c2994 (patch) | |
| tree | d0f82a4250a33db045574fc69137eb32d52d04f9 /src/test | |
| parent | 72b6460336e86ad5cafd3426af6013c7d8457367 (diff) | |
Numeric error suppression in jsonpath
Add support of numeric error suppression to jsonpath as it's required by
standard. This commit doesn't use PG_TRY()/PG_CATCH() in order to implement
that. Instead, it provides internal versions of numeric functions used, which
support error suppression.
Discussion: https://postgr.es/m/fcc6fc6a-b497-f39a-923d-aa34d0c588e8%402ndQuadrant.com
Author: Alexander Korotkov, Nikita Glukhov
Reviewed-by: Tomas Vondra
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/jsonb_jsonpath.out | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/src/test/regress/expected/jsonb_jsonpath.out b/src/test/regress/expected/jsonb_jsonpath.out index c12dfd6b924..0e2e2c474c0 100644 --- a/src/test/regress/expected/jsonb_jsonpath.out +++ b/src/test/regress/expected/jsonb_jsonpath.out @@ -127,13 +127,23 @@ select jsonb_path_query('[1]', 'strict $[1]', silent => true); (0 rows) select jsonb '[1]' @? 'lax $[10000000000000000]'; -ERROR: integer out of range + ?column? +---------- + +(1 row) + select jsonb '[1]' @? 'strict $[10000000000000000]'; -ERROR: integer out of range + ?column? +---------- + +(1 row) + select jsonb_path_query('[1]', 'lax $[10000000000000000]'); -ERROR: integer out of range +ERROR: invalid SQL/JSON subscript +DETAIL: jsonpath array subscript is out of integer range select jsonb_path_query('[1]', 'strict $[10000000000000000]'); -ERROR: integer out of range +ERROR: invalid SQL/JSON subscript +DETAIL: jsonpath array subscript is out of integer range select jsonb '[1]' @? '$[0]'; ?column? ---------- @@ -1037,9 +1047,19 @@ select jsonb '1' @? '$ ? ($ > 0)'; -- arithmetic errors select jsonb_path_query('[1,2,0,3]', '$[*] ? (2 / @ > 0)'); -ERROR: division by zero + jsonb_path_query +------------------ + 1 + 2 + 3 +(3 rows) + select jsonb_path_query('[1,2,0,3]', '$[*] ? ((2 / @ > 0) is unknown)'); -ERROR: division by zero + jsonb_path_query +------------------ + 0 +(1 row) + select jsonb_path_query('0', '1 / $'); ERROR: division by zero select jsonb_path_query('0', '1 / $ + 2'); @@ -1502,7 +1522,8 @@ select jsonb_path_query('"1.23"', '$.double()'); (1 row) select jsonb_path_query('"1.23aaa"', '$.double()'); -ERROR: invalid input syntax for type double precision: "1.23aaa" +ERROR: non-numeric SQL/JSON item +DETAIL: jsonpath item method .double() can only be applied to a numeric value select jsonb_path_query('"nan"', '$.double()'); jsonb_path_query ------------------ |
