40002 — transaction_integrity_constraint_violation
40002 — transaction_integrity_constraint_violation
At a glance
40002 is a catalogue-defined transaction-integrity condition. No distinct PostgreSQL core 40002 call site was resolved in the fixed scan used for this batch, so no foreign-key, unique, or other concrete constraint error is relabeled as this umbrella code. Capture the actual SQLSTATE emitted by the operation.
| Field | Value |
|---|---|
| SQLSTATE | 40002 |
| Condition | transaction_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_T_R_INTEGRITY_CONSTRAINT_VIOLATION |
| Aliases | — |
Meaning
40002 names transaction integrity constraint violation in Class 40, but the fixed PostgreSQL core scan did not resolve a distinct 40002 call site. PostgreSQL’s concrete integrity mechanisms normally report a specific Class 23 code, such as 23502, 23503, 23505, 23514, or 23P01.
Diagnosis
Read the actual SQLSTATE, constraint name, relation, column, and DETAIL from the error. If the server reports a concrete Class 23 code, diagnose that constraint and its transaction state; do not promote it to 40002 because the operation was transactional. This page has no selected natural runtime case or server-specific message template.
Response
Repair the concrete constraint violation and its transaction boundary, then verify the intended durable state. Do not add a generic retry or relabel a known 235xx/23P01 result as 40002; use this class definition only when a real component supplies that code and its own evidence.
Versions
The locked facts table records catalogue presence across the project snapshot range. The fixed source evidence is limited to the path stated below; no exact behavioral introduction or broader runtime coverage is inferred from the definition alone.
Related
Use the concrete integrity code, such as 23503 foreign-key violation or 23505 unique violation, when the server provides one.
Sources
src.errcodes.18.6(SHA-2566e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba)src.calls.REL_18_6fixed call scan (SHA-2569ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf)