22036ERRORTier 2 — Caution✅ HIGH confidencenon-numeric SQL/JSON item
Category: Data ExceptionVersions: Postgres 14+
What this means
SQLSTATE 22036 is raised when a SQL/JSON arithmetic or numeric operation receives a non-numeric value (such as a string or boolean) from a JSON path expression.
Why it happens
- 1Applying arithmetic operators or numeric SQL/JSON functions to a JSON string or boolean value
How to reproduce
SQL/JSON arithmetic on a non-numeric JSON value.
trigger — this will ERROR
SELECT jsonb_path_query('{"x":"hello"}'::jsonb, '$.x + 1');ERROR: operand of unary operator is not a numeric value
Fix 1: Ensure the JSON value is numeric before applying arithmetic
When performing math on JSON values.
fix
SELECT jsonb_path_query('{"x":5}'::jsonb, '$.x + 1');Why this works
Validate JSON schema so that numeric fields contain numbers, not strings.
Version notes
Postgres 14+SQL/JSON arithmetic path operations available from Postgres 12+.Sources
📚 Official docs: https://www.postgresql.org/docs/current/errcodes-appendix.html
🔧 Source ref: Class 22 — Data Exception
Confidence assessment
✅ HIGH confidence
Standard SQLSTATE for SQL/JSON type errors. Stable.
See also
🔗 Related errors
📄 Reference pages
SQL/JSON Path Language
⚙️ This error reference was generated with AI assistance and reviewed for accuracy. Examples are provided to illustrate common scenarios and may not cover every case. Always test fixes in a development environment before applying to production. Spotted an error? Suggest a correction →