23000 — integrity_constraint_violation
23000 — integrity_constraint_violation
At a glance
23000 names the Class 23 integrity-constraint umbrella. It is a protocol category, not a reliable substitute for a concrete PostgreSQL constraint error. Use the exact five-character code returned by the server.
| Field | Value |
|---|---|
| SQLSTATE | 23000 |
| Condition | integrity_constraint_violation |
| Status | active |
| Known present by | 7.4 |
| Locked snapshots | 9.0.23, 9.1.24, 9.2.24, 9.3.25, 9.4.26, 9.5.25, 9.6.24, 10.23, 11.22, 12.22, 13.23, 14.24, 15.19, 16.15, 17.11, 18.6, 19beta3 |
| Macros | ERRCODE_INTEGRITY_CONSTRAINT_VIOLATION |
| Aliases | — |
Meaning
The class covers row and schema operations that violate declared integrity rules. PostgreSQL’s locked errcodes.txt maps concrete mechanisms to descendants such as 23001, 23502, 23503, 23505, 23514, and 23P01. The core PostgreSQL 18.6 call scan contains no resolved 23000 report group, so this page records a definition and dispatch boundary rather than inventing a natural SQL reproduction.
Diagnosis
Read the server SQLSTATE first, then use constraint_name, table_name, column_name, schema_name, and the primary/detail fields when present. A client that collapses every Class 23 value to 23000 loses the distinction needed to repair a NOT NULL, foreign-key, unique, CHECK, exclusion, or RESTRICT failure.
Response
Keep the original statement and transaction boundary. Handle the concrete descendant if one is returned; repair the data or schema rule that it identifies, roll back a failed explicit transaction, and retry only after the intended invariant is satisfied. Do not emit RAISE EXCEPTION ... ERRCODE 23000 as if it demonstrated a natural server path.
Source message templates
Applicability boundary
This batch does not construct a natural SQL trigger for 23000; treat it as a source/protocol boundary rather than a copyable reproduction. structured evidence · case export.
Authored evidence IDs: identity, specific-codes, handling. Selected runtime records: —.
Versions
The locked catalogue observes the umbrella by 7.4 and in every listed 9.0–18.6 formal snapshot. The absence of a resolved 18.6 core call site is a bounded source observation, not a claim about extensions or future releases.
Related
See 23001 RESTRICT violation, 23502 NOT NULL violation, 23514 CHECK violation, 23P01 exclusion violation, and 23505 unique violation.
Sources
src.errcodes.18.6(SHA-2566e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba)src.calls.REL_18_6(SHA-2569ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf)