aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/adt/jsonpath_exec.c86
-rw-r--r--src/test/regress/expected/jsonb_jsonpath.out90
2 files changed, 95 insertions, 81 deletions
diff --git a/src/backend/utils/adt/jsonpath_exec.c b/src/backend/utils/adt/jsonpath_exec.c
index 50fa724b728..3f30bc6222f 100644
--- a/src/backend/utils/adt/jsonpath_exec.c
+++ b/src/backend/utils/adt/jsonpath_exec.c
@@ -1051,10 +1051,15 @@ executeItemOptUnwrapTarget(JsonPathExecContext *cxt, JsonPathItem *jsp,
tmp,
(Node *) &escontext);
- if (escontext.error_occurred || isinf(val) || isnan(val))
+ if (escontext.error_occurred)
+ RETURN_ERROR(ereport(ERROR,
+ (errcode(ERRCODE_NON_NUMERIC_SQL_JSON_ITEM),
+ errmsg("argument \"%s\" of jsonpath item method .%s() is invalid for type double precision",
+ tmp, jspOperationName(jsp->type)))));
+ if (isinf(val) || isnan(val))
RETURN_ERROR(ereport(ERROR,
(errcode(ERRCODE_NON_NUMERIC_SQL_JSON_ITEM),
- errmsg("numeric argument of jsonpath item method .%s() is out of range for type double precision",
+ errmsg("NaN or Infinity is not allowed for jsonpath item method .%s()",
jspOperationName(jsp->type)))));
res = jperOk;
}
@@ -1072,10 +1077,15 @@ executeItemOptUnwrapTarget(JsonPathExecContext *cxt, JsonPathItem *jsp,
tmp,
(Node *) &escontext);
- if (escontext.error_occurred || isinf(val) || isnan(val))
+ if (escontext.error_occurred)
RETURN_ERROR(ereport(ERROR,
(errcode(ERRCODE_NON_NUMERIC_SQL_JSON_ITEM),
- errmsg("string argument of jsonpath item method .%s() is not a valid representation of a double precision number",
+ errmsg("argument \"%s\" of jsonpath item method .%s() is invalid for type double precision",
+ tmp, jspOperationName(jsp->type)))));
+ if (isinf(val) || isnan(val))
+ RETURN_ERROR(ereport(ERROR,
+ (errcode(ERRCODE_NON_NUMERIC_SQL_JSON_ITEM),
+ errmsg("NaN or Infinity is not allowed for jsonpath item method .%s()",
jspOperationName(jsp->type)))));
jb = &jbv;
@@ -1158,7 +1168,9 @@ executeItemOptUnwrapTarget(JsonPathExecContext *cxt, JsonPathItem *jsp,
if (have_error)
RETURN_ERROR(ereport(ERROR,
(errcode(ERRCODE_NON_NUMERIC_SQL_JSON_ITEM),
- errmsg("numeric argument of jsonpath item method .%s() is out of range for type bigint",
+ errmsg("argument \"%s\" of jsonpath item method .%s() is invalid for type bigint",
+ DatumGetCString(DirectFunctionCall1(numeric_out,
+ NumericGetDatum(jb->val.numeric))),
jspOperationName(jsp->type)))));
datum = Int64GetDatum(val);
@@ -1180,8 +1192,8 @@ executeItemOptUnwrapTarget(JsonPathExecContext *cxt, JsonPathItem *jsp,
if (!noerr || escontext.error_occurred)
RETURN_ERROR(ereport(ERROR,
(errcode(ERRCODE_NON_NUMERIC_SQL_JSON_ITEM),
- errmsg("string argument of jsonpath item method .%s() is not a valid representation of a big integer",
- jspOperationName(jsp->type)))));
+ errmsg("argument \"%s\" of jsonpath item method .%s() is invalid for type bigint",
+ tmp, jspOperationName(jsp->type)))));
res = jperOk;
}
@@ -1232,8 +1244,8 @@ executeItemOptUnwrapTarget(JsonPathExecContext *cxt, JsonPathItem *jsp,
if (!noerr || escontext.error_occurred)
RETURN_ERROR(ereport(ERROR,
(errcode(ERRCODE_NON_NUMERIC_SQL_JSON_ITEM),
- errmsg("numeric argument of jsonpath item method .%s() is out of range for type boolean",
- jspOperationName(jsp->type)))));
+ errmsg("argument \"%s\" of jsonpath item method .%s() is invalid for type boolean",
+ tmp, jspOperationName(jsp->type)))));
ival = DatumGetInt32(datum);
if (ival == 0)
@@ -1252,8 +1264,8 @@ executeItemOptUnwrapTarget(JsonPathExecContext *cxt, JsonPathItem *jsp,
if (!parse_bool(tmp, &bval))
RETURN_ERROR(ereport(ERROR,
(errcode(ERRCODE_NON_NUMERIC_SQL_JSON_ITEM),
- errmsg("string argument of jsonpath item method .%s() is not a valid representation of a boolean",
- jspOperationName(jsp->type)))));
+ errmsg("argument \"%s\" of jsonpath item method .%s() is invalid for type boolean",
+ tmp, jspOperationName(jsp->type)))));
res = jperOk;
}
@@ -1289,7 +1301,7 @@ executeItemOptUnwrapTarget(JsonPathExecContext *cxt, JsonPathItem *jsp,
if (numeric_is_nan(num) || numeric_is_inf(num))
RETURN_ERROR(ereport(ERROR,
(errcode(ERRCODE_NON_NUMERIC_SQL_JSON_ITEM),
- errmsg("numeric argument of jsonpath item method .%s() is out of range for type decimal or number",
+ errmsg("NaN or Infinity is not allowed for jsonpath item method .%s()",
jspOperationName(jsp->type)))));
if (jsp->type == jpiDecimal)
@@ -1314,14 +1326,14 @@ executeItemOptUnwrapTarget(JsonPathExecContext *cxt, JsonPathItem *jsp,
if (!noerr || escontext.error_occurred)
RETURN_ERROR(ereport(ERROR,
(errcode(ERRCODE_NON_NUMERIC_SQL_JSON_ITEM),
- errmsg("string argument of jsonpath item method .%s() is not a valid representation of a decimal or number",
- jspOperationName(jsp->type)))));
+ errmsg("argument \"%s\" of jsonpath item method .%s() is invalid for type numeric",
+ numstr, jspOperationName(jsp->type)))));
num = DatumGetNumeric(datum);
if (numeric_is_nan(num) || numeric_is_inf(num))
RETURN_ERROR(ereport(ERROR,
(errcode(ERRCODE_NON_NUMERIC_SQL_JSON_ITEM),
- errmsg("string argument of jsonpath item method .%s() is not a valid representation of a decimal or number",
+ errmsg("NaN or Infinity is not allowed for jsonpath item method .%s()",
jspOperationName(jsp->type)))));
res = jperOk;
@@ -1403,8 +1415,8 @@ executeItemOptUnwrapTarget(JsonPathExecContext *cxt, JsonPathItem *jsp,
if (!noerr || escontext.error_occurred)
RETURN_ERROR(ereport(ERROR,
(errcode(ERRCODE_NON_NUMERIC_SQL_JSON_ITEM),
- errmsg("string argument of jsonpath item method .%s() is not a valid representation of a decimal or number",
- jspOperationName(jsp->type)))));
+ errmsg("argument \"%s\" of jsonpath item method .%s() is invalid for type numeric",
+ numstr, jspOperationName(jsp->type)))));
num = DatumGetNumeric(numdatum);
pfree(arrtypmod);
@@ -1436,7 +1448,9 @@ executeItemOptUnwrapTarget(JsonPathExecContext *cxt, JsonPathItem *jsp,
if (have_error)
RETURN_ERROR(ereport(ERROR,
(errcode(ERRCODE_NON_NUMERIC_SQL_JSON_ITEM),
- errmsg("numeric argument of jsonpath item method .%s() is out of range for type integer",
+ errmsg("argument \"%s\" of jsonpath item method .%s() is invalid for type integer",
+ DatumGetCString(DirectFunctionCall1(numeric_out,
+ NumericGetDatum(jb->val.numeric))),
jspOperationName(jsp->type)))));
datum = Int32GetDatum(val);
@@ -1458,8 +1472,8 @@ executeItemOptUnwrapTarget(JsonPathExecContext *cxt, JsonPathItem *jsp,
if (!noerr || escontext.error_occurred)
RETURN_ERROR(ereport(ERROR,
(errcode(ERRCODE_NON_NUMERIC_SQL_JSON_ITEM),
- errmsg("string argument of jsonpath item method .%s() is not a valid representation of an integer",
- jspOperationName(jsp->type)))));
+ errmsg("argument \"%s\" of jsonpath item method .%s() is invalid for type integer",
+ tmp, jspOperationName(jsp->type)))));
res = jperOk;
}
@@ -2373,8 +2387,8 @@ executeDateTimeMethod(JsonPathExecContext *cxt, JsonPathItem *jsp,
if (jsp->type == jpiDatetime)
RETURN_ERROR(ereport(ERROR,
(errcode(ERRCODE_INVALID_ARGUMENT_FOR_SQL_JSON_DATETIME_FUNCTION),
- errmsg("datetime format is not recognized: \"%s\"",
- text_to_cstring(datetime)),
+ errmsg("%s format is not recognized: \"%s\"",
+ "datetime", text_to_cstring(datetime)),
errhint("Use a datetime template argument to specify the input data format."))));
else
RETURN_ERROR(ereport(ERROR,
@@ -2406,8 +2420,8 @@ executeDateTimeMethod(JsonPathExecContext *cxt, JsonPathItem *jsp,
case TIMETZOID:
RETURN_ERROR(ereport(ERROR,
(errcode(ERRCODE_INVALID_ARGUMENT_FOR_SQL_JSON_DATETIME_FUNCTION),
- errmsg("date format is not recognized: \"%s\"",
- text_to_cstring(datetime)))));
+ errmsg("%s format is not recognized: \"%s\"",
+ "date", text_to_cstring(datetime)))));
break;
case TIMESTAMPOID:
value = DirectFunctionCall1(timestamp_date,
@@ -2434,8 +2448,8 @@ executeDateTimeMethod(JsonPathExecContext *cxt, JsonPathItem *jsp,
case DATEOID:
RETURN_ERROR(ereport(ERROR,
(errcode(ERRCODE_INVALID_ARGUMENT_FOR_SQL_JSON_DATETIME_FUNCTION),
- errmsg("time format is not recognized: \"%s\"",
- text_to_cstring(datetime)))));
+ errmsg("%s format is not recognized: \"%s\"",
+ "time", text_to_cstring(datetime)))));
break;
case TIMEOID: /* Nothing to do for TIME */
break;
@@ -2487,8 +2501,8 @@ executeDateTimeMethod(JsonPathExecContext *cxt, JsonPathItem *jsp,
case TIMESTAMPOID:
RETURN_ERROR(ereport(ERROR,
(errcode(ERRCODE_INVALID_ARGUMENT_FOR_SQL_JSON_DATETIME_FUNCTION),
- errmsg("time_tz format is not recognized: \"%s\"",
- text_to_cstring(datetime)))));
+ errmsg("%s format is not recognized: \"%s\"",
+ "time_tz", text_to_cstring(datetime)))));
break;
case TIMEOID:
checkTimezoneIsUsedForCast(cxt->useTz,
@@ -2538,8 +2552,8 @@ executeDateTimeMethod(JsonPathExecContext *cxt, JsonPathItem *jsp,
case TIMETZOID:
RETURN_ERROR(ereport(ERROR,
(errcode(ERRCODE_INVALID_ARGUMENT_FOR_SQL_JSON_DATETIME_FUNCTION),
- errmsg("timestamp format is not recognized: \"%s\"",
- text_to_cstring(datetime)))));
+ errmsg("%s format is not recognized: \"%s\"",
+ "timestamp", text_to_cstring(datetime)))));
break;
case TIMESTAMPOID: /* Nothing to do for TIMESTAMP */
break;
@@ -2565,10 +2579,10 @@ executeDateTimeMethod(JsonPathExecContext *cxt, JsonPathItem *jsp,
result = DatumGetTimestamp(value);
AdjustTimestampForTypmod(&result, time_precision,
(Node *) &escontext);
- if (escontext.error_occurred)
+ if (escontext.error_occurred) /* should not happen */
RETURN_ERROR(ereport(ERROR,
(errcode(ERRCODE_INVALID_ARGUMENT_FOR_SQL_JSON_DATETIME_FUNCTION),
- errmsg("numeric argument of jsonpath item method .%s() is out of range for type integer",
+ errmsg("time precision of jsonpath item method .%s() is invalid",
jspOperationName(jsp->type)))));
value = TimestampGetDatum(result);
@@ -2594,8 +2608,8 @@ executeDateTimeMethod(JsonPathExecContext *cxt, JsonPathItem *jsp,
case TIMETZOID:
RETURN_ERROR(ereport(ERROR,
(errcode(ERRCODE_INVALID_ARGUMENT_FOR_SQL_JSON_DATETIME_FUNCTION),
- errmsg("timestamp_tz format is not recognized: \"%s\"",
- text_to_cstring(datetime)))));
+ errmsg("%s format is not recognized: \"%s\"",
+ "timestamp_tz", text_to_cstring(datetime)))));
break;
case TIMESTAMPOID:
checkTimezoneIsUsedForCast(cxt->useTz,
@@ -2621,10 +2635,10 @@ executeDateTimeMethod(JsonPathExecContext *cxt, JsonPathItem *jsp,
result = DatumGetTimestampTz(value);
AdjustTimestampForTypmod(&result, time_precision,
(Node *) &escontext);
- if (escontext.error_occurred)
+ if (escontext.error_occurred) /* should not happen */
RETURN_ERROR(ereport(ERROR,
(errcode(ERRCODE_INVALID_ARGUMENT_FOR_SQL_JSON_DATETIME_FUNCTION),
- errmsg("numeric argument of jsonpath item method .%s() is out of range for type integer",
+ errmsg("time precision of jsonpath item method .%s() is invalid",
jspOperationName(jsp->type)))));
value = TimestampTzGetDatum(result);
diff --git a/src/test/regress/expected/jsonb_jsonpath.out b/src/test/regress/expected/jsonb_jsonpath.out
index 414c2965cd6..c3f8e8249db 100644
--- a/src/test/regress/expected/jsonb_jsonpath.out
+++ b/src/test/regress/expected/jsonb_jsonpath.out
@@ -1496,17 +1496,17 @@ select jsonb_path_query('"1.23"', '$.double()');
(1 row)
select jsonb_path_query('"1.23aaa"', '$.double()');
-ERROR: string argument of jsonpath item method .double() is not a valid representation of a double precision number
+ERROR: argument "1.23aaa" of jsonpath item method .double() is invalid for type double precision
select jsonb_path_query('1e1000', '$.double()');
-ERROR: numeric argument of jsonpath item method .double() is out of range for type double precision
+ERROR: argument "10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" of jsonpath item method .double() is invalid for type double precision
select jsonb_path_query('"nan"', '$.double()');
-ERROR: string argument of jsonpath item method .double() is not a valid representation of a double precision number
+ERROR: NaN or Infinity is not allowed for jsonpath item method .double()
select jsonb_path_query('"NaN"', '$.double()');
-ERROR: string argument of jsonpath item method .double() is not a valid representation of a double precision number
+ERROR: NaN or Infinity is not allowed for jsonpath item method .double()
select jsonb_path_query('"inf"', '$.double()');
-ERROR: string argument of jsonpath item method .double() is not a valid representation of a double precision number
+ERROR: NaN or Infinity is not allowed for jsonpath item method .double()
select jsonb_path_query('"-inf"', '$.double()');
-ERROR: string argument of jsonpath item method .double() is not a valid representation of a double precision number
+ERROR: NaN or Infinity is not allowed for jsonpath item method .double()
select jsonb_path_query('"inf"', '$.double()', silent => true);
jsonb_path_query
------------------
@@ -1767,19 +1767,19 @@ select jsonb_path_query('{}', '$.bigint()', silent => true);
(0 rows)
select jsonb_path_query('"1.23"', '$.bigint()');
-ERROR: string argument of jsonpath item method .bigint() is not a valid representation of a big integer
+ERROR: argument "1.23" of jsonpath item method .bigint() is invalid for type bigint
select jsonb_path_query('"1.23aaa"', '$.bigint()');
-ERROR: string argument of jsonpath item method .bigint() is not a valid representation of a big integer
+ERROR: argument "1.23aaa" of jsonpath item method .bigint() is invalid for type bigint
select jsonb_path_query('1e1000', '$.bigint()');
-ERROR: numeric argument of jsonpath item method .bigint() is out of range for type bigint
+ERROR: argument "10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" of jsonpath item method .bigint() is invalid for type bigint
select jsonb_path_query('"nan"', '$.bigint()');
-ERROR: string argument of jsonpath item method .bigint() is not a valid representation of a big integer
+ERROR: argument "nan" of jsonpath item method .bigint() is invalid for type bigint
select jsonb_path_query('"NaN"', '$.bigint()');
-ERROR: string argument of jsonpath item method .bigint() is not a valid representation of a big integer
+ERROR: argument "NaN" of jsonpath item method .bigint() is invalid for type bigint
select jsonb_path_query('"inf"', '$.bigint()');
-ERROR: string argument of jsonpath item method .bigint() is not a valid representation of a big integer
+ERROR: argument "inf" of jsonpath item method .bigint() is invalid for type bigint
select jsonb_path_query('"-inf"', '$.bigint()');
-ERROR: string argument of jsonpath item method .bigint() is not a valid representation of a big integer
+ERROR: argument "-inf" of jsonpath item method .bigint() is invalid for type bigint
select jsonb_path_query('"inf"', '$.bigint()', silent => true);
jsonb_path_query
------------------
@@ -1827,9 +1827,9 @@ select jsonb_path_query('"1234567890123"', '$.bigint()');
(1 row)
select jsonb_path_query('12345678901234567890', '$.bigint()');
-ERROR: numeric argument of jsonpath item method .bigint() is out of range for type bigint
+ERROR: argument "12345678901234567890" of jsonpath item method .bigint() is invalid for type bigint
select jsonb_path_query('"12345678901234567890"', '$.bigint()');
-ERROR: string argument of jsonpath item method .bigint() is not a valid representation of a big integer
+ERROR: argument "12345678901234567890" of jsonpath item method .bigint() is invalid for type bigint
select jsonb_path_query('"+123"', '$.bigint()');
jsonb_path_query
------------------
@@ -1882,21 +1882,21 @@ select jsonb_path_query('{}', '$.boolean()', silent => true);
(0 rows)
select jsonb_path_query('1.23', '$.boolean()');
-ERROR: numeric argument of jsonpath item method .boolean() is out of range for type boolean
+ERROR: argument "1.23" of jsonpath item method .boolean() is invalid for type boolean
select jsonb_path_query('"1.23"', '$.boolean()');
-ERROR: string argument of jsonpath item method .boolean() is not a valid representation of a boolean
+ERROR: argument "1.23" of jsonpath item method .boolean() is invalid for type boolean
select jsonb_path_query('"1.23aaa"', '$.boolean()');
-ERROR: string argument of jsonpath item method .boolean() is not a valid representation of a boolean
+ERROR: argument "1.23aaa" of jsonpath item method .boolean() is invalid for type boolean
select jsonb_path_query('1e1000', '$.boolean()');
-ERROR: numeric argument of jsonpath item method .boolean() is out of range for type boolean
+ERROR: argument "10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" of jsonpath item method .boolean() is invalid for type boolean
select jsonb_path_query('"nan"', '$.boolean()');
-ERROR: string argument of jsonpath item method .boolean() is not a valid representation of a boolean
+ERROR: argument "nan" of jsonpath item method .boolean() is invalid for type boolean
select jsonb_path_query('"NaN"', '$.boolean()');
-ERROR: string argument of jsonpath item method .boolean() is not a valid representation of a boolean
+ERROR: argument "NaN" of jsonpath item method .boolean() is invalid for type boolean
select jsonb_path_query('"inf"', '$.boolean()');
-ERROR: string argument of jsonpath item method .boolean() is not a valid representation of a boolean
+ERROR: argument "inf" of jsonpath item method .boolean() is invalid for type boolean
select jsonb_path_query('"-inf"', '$.boolean()');
-ERROR: string argument of jsonpath item method .boolean() is not a valid representation of a boolean
+ERROR: argument "-inf" of jsonpath item method .boolean() is invalid for type boolean
select jsonb_path_query('"inf"', '$.boolean()', silent => true);
jsonb_path_query
------------------
@@ -1908,7 +1908,7 @@ select jsonb_path_query('"-inf"', '$.boolean()', silent => true);
(0 rows)
select jsonb_path_query('"100"', '$.boolean()');
-ERROR: string argument of jsonpath item method .boolean() is not a valid representation of a boolean
+ERROR: argument "100" of jsonpath item method .boolean() is invalid for type boolean
select jsonb_path_query('true', '$.boolean()');
jsonb_path_query
------------------
@@ -2147,7 +2147,7 @@ select jsonb_path_query('"1.23"', '$.decimal()');
(1 row)
select jsonb_path_query('"1.23aaa"', '$.decimal()');
-ERROR: string argument of jsonpath item method .decimal() is not a valid representation of a decimal or number
+ERROR: argument "1.23aaa" of jsonpath item method .decimal() is invalid for type numeric
select jsonb_path_query('1e1000', '$.decimal()');
jsonb_path_query
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -2155,13 +2155,13 @@ select jsonb_path_query('1e1000', '$.decimal()');
(1 row)
select jsonb_path_query('"nan"', '$.decimal()');
-ERROR: string argument of jsonpath item method .decimal() is not a valid representation of a decimal or number
+ERROR: NaN or Infinity is not allowed for jsonpath item method .decimal()
select jsonb_path_query('"NaN"', '$.decimal()');
-ERROR: string argument of jsonpath item method .decimal() is not a valid representation of a decimal or number
+ERROR: NaN or Infinity is not allowed for jsonpath item method .decimal()
select jsonb_path_query('"inf"', '$.decimal()');
-ERROR: string argument of jsonpath item method .decimal() is not a valid representation of a decimal or number
+ERROR: NaN or Infinity is not allowed for jsonpath item method .decimal()
select jsonb_path_query('"-inf"', '$.decimal()');
-ERROR: string argument of jsonpath item method .decimal() is not a valid representation of a decimal or number
+ERROR: NaN or Infinity is not allowed for jsonpath item method .decimal()
select jsonb_path_query('"inf"', '$.decimal()', silent => true);
jsonb_path_query
------------------
@@ -2227,7 +2227,7 @@ select jsonb_path_query('12345.678', '$.decimal(6, 1)');
(1 row)
select jsonb_path_query('12345.678', '$.decimal(6, 2)');
-ERROR: string argument of jsonpath item method .decimal() is not a valid representation of a decimal or number
+ERROR: argument "12345.678" of jsonpath item method .decimal() is invalid for type numeric
select jsonb_path_query('1234.5678', '$.decimal(6, 2)');
jsonb_path_query
------------------
@@ -2235,7 +2235,7 @@ select jsonb_path_query('1234.5678', '$.decimal(6, 2)');
(1 row)
select jsonb_path_query('12345.678', '$.decimal(4, 6)');
-ERROR: string argument of jsonpath item method .decimal() is not a valid representation of a decimal or number
+ERROR: argument "12345.678" of jsonpath item method .decimal() is invalid for type numeric
select jsonb_path_query('12345.678', '$.decimal(0, 6)');
ERROR: NUMERIC precision 0 must be between 1 and 1000
select jsonb_path_query('12345.678', '$.decimal(1001, 6)');
@@ -2321,19 +2321,19 @@ select jsonb_path_query('{}', '$.integer()', silent => true);
(0 rows)
select jsonb_path_query('"1.23"', '$.integer()');
-ERROR: string argument of jsonpath item method .integer() is not a valid representation of an integer
+ERROR: argument "1.23" of jsonpath item method .integer() is invalid for type integer
select jsonb_path_query('"1.23aaa"', '$.integer()');
-ERROR: string argument of jsonpath item method .integer() is not a valid representation of an integer
+ERROR: argument "1.23aaa" of jsonpath item method .integer() is invalid for type integer
select jsonb_path_query('1e1000', '$.integer()');
-ERROR: numeric argument of jsonpath item method .integer() is out of range for type integer
+ERROR: argument "10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" of jsonpath item method .integer() is invalid for type integer
select jsonb_path_query('"nan"', '$.integer()');
-ERROR: string argument of jsonpath item method .integer() is not a valid representation of an integer
+ERROR: argument "nan" of jsonpath item method .integer() is invalid for type integer
select jsonb_path_query('"NaN"', '$.integer()');
-ERROR: string argument of jsonpath item method .integer() is not a valid representation of an integer
+ERROR: argument "NaN" of jsonpath item method .integer() is invalid for type integer
select jsonb_path_query('"inf"', '$.integer()');
-ERROR: string argument of jsonpath item method .integer() is not a valid representation of an integer
+ERROR: argument "inf" of jsonpath item method .integer() is invalid for type integer
select jsonb_path_query('"-inf"', '$.integer()');
-ERROR: string argument of jsonpath item method .integer() is not a valid representation of an integer
+ERROR: argument "-inf" of jsonpath item method .integer() is invalid for type integer
select jsonb_path_query('"inf"', '$.integer()', silent => true);
jsonb_path_query
------------------
@@ -2369,9 +2369,9 @@ select jsonb_path_query('1.83', '$.integer()');
(1 row)
select jsonb_path_query('12345678901', '$.integer()');
-ERROR: numeric argument of jsonpath item method .integer() is out of range for type integer
+ERROR: argument "12345678901" of jsonpath item method .integer() is invalid for type integer
select jsonb_path_query('"12345678901"', '$.integer()');
-ERROR: string argument of jsonpath item method .integer() is not a valid representation of an integer
+ERROR: argument "12345678901" of jsonpath item method .integer() is invalid for type integer
select jsonb_path_query('"+123"', '$.integer()');
jsonb_path_query
------------------
@@ -2443,7 +2443,7 @@ select jsonb_path_query('"1.23"', '$.number()');
(1 row)
select jsonb_path_query('"1.23aaa"', '$.number()');
-ERROR: string argument of jsonpath item method .number() is not a valid representation of a decimal or number
+ERROR: argument "1.23aaa" of jsonpath item method .number() is invalid for type numeric
select jsonb_path_query('1e1000', '$.number()');
jsonb_path_query
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -2451,13 +2451,13 @@ select jsonb_path_query('1e1000', '$.number()');
(1 row)
select jsonb_path_query('"nan"', '$.number()');
-ERROR: string argument of jsonpath item method .number() is not a valid representation of a decimal or number
+ERROR: NaN or Infinity is not allowed for jsonpath item method .number()
select jsonb_path_query('"NaN"', '$.number()');
-ERROR: string argument of jsonpath item method .number() is not a valid representation of a decimal or number
+ERROR: NaN or Infinity is not allowed for jsonpath item method .number()
select jsonb_path_query('"inf"', '$.number()');
-ERROR: string argument of jsonpath item method .number() is not a valid representation of a decimal or number
+ERROR: NaN or Infinity is not allowed for jsonpath item method .number()
select jsonb_path_query('"-inf"', '$.number()');
-ERROR: string argument of jsonpath item method .number() is not a valid representation of a decimal or number
+ERROR: NaN or Infinity is not allowed for jsonpath item method .number()
select jsonb_path_query('"inf"', '$.number()', silent => true);
jsonb_path_query
------------------