# Common codes

> A curated list of SQLSTATE values useful during incident triage.
---

This is an editorial entry point for frequent diagnosis paths. It is not a measured ranking of production frequency; each row states the practical question the entry helps answer and preserves its review state.

<!-- BEGIN SQLSTATE INDEX: generated by scripts/generate.py; do not edit -->

| Code | Condition | Why start here |
| --- | --- | --- |
| [`23505`](../23505/) | `unique_violation` | Duplicate keys, constraints, and idempotent writes. |
| [`23503`](../23503/) | `foreign_key_violation` | Foreign-key repair and dependency order. |
| [`23502`](../23502/) | `not_null_violation` | Missing required values and input validation. |
| [`23514`](../23514/) | `check_violation` | CHECK constraints and invariant failures. |
| [`23P01`](../23p01/) | `exclusion_violation` | Exclusion constraints and range conflicts. |
| [`40P01`](../40p01/) | `deadlock_detected` | Deadlock diagnosis, rollback, and lock ordering. |
| [`40001`](../40001/) | `serialization_failure` | Serializable retry and fresh transaction snapshots. |
| [`25P02`](../25p02/) | `in_failed_sql_transaction` | The failed transaction state that follows an error. |
| [`42P01`](../42p01/) | `undefined_table` | Missing relations and search-path diagnosis. |
| [`42601`](../42601/) | `syntax_error` | Syntax errors before a statement can execute. |
| [`42501`](../42501/) | `insufficient_privilege` | Privilege checks and authorization failures. |
| [`28P01`](../28p01/) | `invalid_password` | Password authentication and connection setup. |
| [`57014`](../57014/) | `query_canceled` | Cancellation, statement_timeout, and safe follow-up. |
| [`53300`](../53300/) | `too_many_connections` | Connection limits and admission failures. |
| [`2202E`](../2202e/) | `array_subscript_error` | Array dimensions, concatenation, and type rules. |
| [`01000`](../01000/) | `warning` | Warning dispatch and non-error diagnostics. |
| [`P0001`](../p0001/) | `raise_exception` | Application-defined PL/pgSQL exceptions. |
| [`XX000`](../xx000/) | `internal_error` | Internal-error safety boundaries and escalation. |

<!-- END SQLSTATE INDEX -->

---

Backlinks:

- [SQLSTATE Atlas](/)
