if (have_error)
RETURN_ERROR(ereport(ERROR,
(errcode(ERRCODE_NON_NUMERIC_SQL_JSON_ITEM),
- errmsg("jsonpath item method .%s() can only be applied to a numeric value",
+ errmsg("numeric argument of jsonpath item method .%s() is out of range for type double precision",
jspOperationName(jsp->type)))));
res = jperOk;
}
if (have_error || isinf(val))
RETURN_ERROR(ereport(ERROR,
(errcode(ERRCODE_NON_NUMERIC_SQL_JSON_ITEM),
- errmsg("jsonpath item method .%s() can only be applied to a numeric value",
+ errmsg("string argument of jsonpath item method .%s() is not a valid representation of a double precision number",
jspOperationName(jsp->type)))));
jb = &jbv;
(1 row)
select jsonb_path_query('"1.23aaa"', '$.double()');
-ERROR: jsonpath item method .double() can only be applied to a numeric value
+ERROR: string argument of jsonpath item method .double() is not a valid representation of a double precision number
+select jsonb_path_query('1e1000', '$.double()');
+ERROR: numeric argument of jsonpath item method .double() is out of range for type double precision
select jsonb_path_query('"nan"', '$.double()');
jsonb_path_query
------------------
(1 row)
select jsonb_path_query('"inf"', '$.double()');
-ERROR: jsonpath item method .double() can only be applied to a numeric value
+ERROR: string argument of jsonpath item method .double() is not a valid representation of a double precision number
select jsonb_path_query('"-inf"', '$.double()');
-ERROR: jsonpath item method .double() can only be applied to a numeric value
+ERROR: string argument of jsonpath item method .double() is not a valid representation of a double precision number
select jsonb_path_query('"inf"', '$.double()', silent => true);
jsonb_path_query
------------------
select jsonb_path_query('1.23', '$.double()');
select jsonb_path_query('"1.23"', '$.double()');
select jsonb_path_query('"1.23aaa"', '$.double()');
+select jsonb_path_query('1e1000', '$.double()');
select jsonb_path_query('"nan"', '$.double()');
select jsonb_path_query('"NaN"', '$.double()');
select jsonb_path_query('"inf"', '$.double()');