# 23000 — integrity_constraint_violation

> PostgreSQL SQLSTATE 23000: the Class 23 integrity_constraint_violation umbrella and its concrete descendants.
---

# 23000 — integrity_constraint_violation

## At a glance {#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.

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

| 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 | `—` |

<!-- source facts: data/errcodes/23000.json -->
<!-- END SQLSTATE FACTS -->

## Meaning {#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 {#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 {#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 {#messages}


## Applicability boundary {#case}

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](../data/evidence/23000.json) · [case export](../data/cases/23000.json).

Authored evidence IDs: `identity`, `specific-codes`, `handling`. Selected runtime records: —.

## Versions {#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 {#related}

See [23001 RESTRICT violation](../23001/), [23502 NOT NULL violation](../23502/), [23514 CHECK violation](../23514/), [23P01 exclusion violation](../23p01/), and [23505 unique violation](../23505/).

## Sources {#sources}

- [`src.errcodes.18.6`](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt) (SHA-256 `6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba`)
- `src.calls.REL_18_6` (SHA-256 `9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf`)
