mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Improve jsonb cast error message
Initial variant of error message didn't follow style of another casting error messages and wasn't informative. Per gripe from Robert Haas. Reviewer: Tom Lane Discussion: https://www.postgresql.org/message-id/flat/CA%2BTgmob08StTV9yu04D0idRFNMh%2BUoyKax5Otvrix7rEZC8rMw%40mail.gmail.com#CA+Tgmob08StTV9yu04D0idRFNMh+UoyKax5Otvrix7rEZC8rMw@mail.gmail.com
This commit is contained in:
@ -4321,7 +4321,7 @@ select 'true'::jsonb::bool;
|
||||
(1 row)
|
||||
|
||||
select '[]'::jsonb::bool;
|
||||
ERROR: jsonb value must be boolean
|
||||
ERROR: cannot cast jsonb array to type boolean
|
||||
select '1.0'::jsonb::float;
|
||||
float8
|
||||
--------
|
||||
@ -4329,7 +4329,7 @@ select '1.0'::jsonb::float;
|
||||
(1 row)
|
||||
|
||||
select '[1.0]'::jsonb::float;
|
||||
ERROR: jsonb value must be numeric
|
||||
ERROR: cannot cast jsonb array to type double precision
|
||||
select '12345'::jsonb::int4;
|
||||
int4
|
||||
-------
|
||||
@ -4337,7 +4337,7 @@ select '12345'::jsonb::int4;
|
||||
(1 row)
|
||||
|
||||
select '"hello"'::jsonb::int4;
|
||||
ERROR: jsonb value must be numeric
|
||||
ERROR: cannot cast jsonb string to type integer
|
||||
select '12345'::jsonb::numeric;
|
||||
numeric
|
||||
---------
|
||||
@ -4345,7 +4345,7 @@ select '12345'::jsonb::numeric;
|
||||
(1 row)
|
||||
|
||||
select '{}'::jsonb::numeric;
|
||||
ERROR: jsonb value must be numeric
|
||||
ERROR: cannot cast jsonb object to type numeric
|
||||
select '12345.05'::jsonb::numeric;
|
||||
numeric
|
||||
----------
|
||||
|
Reference in New Issue
Block a user