Skip to content

40000 — transaction_rollback

Source-backed reference for PostgreSQL SQLSTATE 40000, with explicit mechanism boundaries.

40000 — transaction_rollback

At a glance

40000 is an umbrella transaction-rollback condition. The fixed 18.6 source contains an internal system-catalog-scan path with transaction aborted during system catalog scan; reproducing that path would require an internal fault or visibility condition outside a safe SQL-only case. Do not turn a serialization failure, deadlock, or arbitrary client cancellation into 40000.

Field Value
SQLSTATE 40000
Condition transaction_rollback
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_TRANSACTION_ROLLBACK
Aliases

Meaning

40000 is the broad transaction rollback condition. The resolved core path in genam.c is a defensive internal error: a transaction aborted during a system catalog scan. It is not the normal client-visible retry path represented by 40001, and it is not a deadlock report.

Diagnosis

For a real 40000, preserve the server log, backend PID, operation, and source diagnostics; the fixed primary template is transaction aborted during system catalog scan. Check whether the log points to an internal catalog/index visibility failure or a server fault. A client-side ROLLBACK, serialization failure, or canceled statement is insufficient evidence for this code, and the selected scan has no safe SQL-only reproduction.

Response

Let the failed transaction end as the server requires, then investigate the catalog/index and server health before retrying. Reconnect only when the session is unusable, and verify durable state before repeating a write. Do not turn 40001/40P01 or a generic rollback into 40000; this page records the internal source boundary only.

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.

Compare 40001 serialization failure and 40P01 deadlock detected for retryable transaction rollback mechanisms with concrete SQL paths.

Sources

  • src.errcodes.18.6 (SHA-256 6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba)
  • source path (SHA-256 11897b1d8b1ae1f4a1bef9a72e740da7aa83579abf84e4ca5ebacd6530874c28)