PG
PRO
22000ERRORTier 2 — Caution✅ HIGH confidence

data exception

Category: Data ExceptionVersions: All Postgres versions

What this means

SQLSTATE 22000 is the generic data exception code. It is raised when an error related to data values occurs that does not map to a more specific 22xxx subcode. Check the error detail message for the actual cause.

Why it happens

  1. 1Data value is invalid for the operation or target type, without a more specific 22xxx code applying

How to reproduce

Generic data validation failure.

trigger — this will ERROR
ERROR: data exception

Fix 1: Inspect the error DETAIL and HINT for the specific data issue

When 22000 appears in application logs.

fix

Why this works

Postgres always includes a detail message with 22000. Read it to find the actual problematic value and column, then apply data cleaning or schema correction.

Sources

📚 Official docs: https://www.postgresql.org/docs/current/errcodes-appendix.html

🔧 Source ref: Class 22 — Data Exception

Confidence assessment

✅ HIGH confidence

Standard SQLSTATE generic data exception. Stable across all versions.

See also

⚙️ 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 →