2203CERRORTier 2 — Caution✅ HIGH confidenceSQL/JSON object not found
Category: Data ExceptionVersions: Postgres 14+
What this means
SQLSTATE 2203C is raised when a SQL/JSON member accessor is applied to a value that is not a JSON object (e.g., applied to an array or scalar).
Why it happens
- 1Using a dot (member) accessor on a JSON array, number, string, or boolean value in strict mode
How to reproduce
Member accessor on a non-object JSON value.
trigger — this will ERROR
SELECT jsonb_path_query('[1,2,3]'::jsonb, 'strict $.key');ERROR: jsonpath member accessor can only be applied to an object
Fix 1: Use array subscripts for arrays, member accessors for objects
When the JSON structure type is known.
fix
SELECT jsonb_path_query('[1,2,3]'::jsonb, '$[0]'); -- array subscriptWhy this works
Use [n] for array access and .key for object member access in JSON path expressions.
Version notes
Postgres 14+Strict mode type checking refined in Postgres 14.Sources
📚 Official docs: https://www.postgresql.org/docs/current/errcodes-appendix.html
🔧 Source ref: Class 22 — Data Exception
Confidence assessment
✅ HIGH confidence
Standard SQLSTATE. Stable.
See also
📄 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 →