2203B
PostgreSQLERRORNotableData ExceptionHIGH confidence
SQL/JSON number not found
What this means
SQLSTATE 2203B is raised when a SQL/JSON operation expects a numeric value but finds a non-numeric JSON value.
Why it happens
- 1Applying a numeric SQL/JSON method or operation to a JSON string, boolean, or null value
How to reproduce
SQL/JSON numeric method on a non-numeric value.
trigger — this will error
trigger — this will error
SELECT jsonb_path_query('"hello"'::jsonb, '$.double()');expected output
ERROR: string argument of jsonpath item method .double() is not a valid representation of a double precision number
Fix
Ensure the JSON value is numeric before applying numeric methods
WHEN When using .double(), .integer(), or similar numeric JSON path methods.
Ensure the JSON value is numeric before applying numeric methods
SELECT jsonb_path_query('3.14'::jsonb, '$.double()');Why this works
Validate JSON schema or use jsonb_typeof() to confirm the value is a number.
Version notes
Postgres 14+
JSON path item methods available from Postgres 12+.
Sources
Official documentation ↗
Class 22 — Data Exception
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev