This is a followup to commit 66ea94e8e6.
Error mssages concerning incorrect formats for date-time types are
unified and parameterized, instead of using a fully separate error
message for each type.
Similarly, error messages regarding numeric and string arguments to
certain items are standardized, and instead of saying that the argument
is out of range simply say that it is invalid. The actual invalid
arguments to these itesm are now shown in the error message.
Error messages relating to numeric inputs of Nan or Infinity are
made more informative.
Jeevan Chalke and Kyotaro Horiguchi, with some input from Tom Lane.
Discussion: https://postgr.es/m/20240129.121200.235012930453045390.horikyota.ntt@gmail.com
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()
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
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
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