select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

SQLSTATE / CLASS 40 · TRANSACTION ROLLBACK

transaction_rollback

SQLSTATE
40000
Condition name
transaction_rollback
Class
Transaction Rollback
Source macro
ERRCODE_TRANSACTION_ROLLBACK
Evidence
Source path confirmed
Analysis & operational context

English SQLSTATE atlas: authored explanations and source/runtime evidence are separate from the manual definitions. View source ↗

<h1>40000 — transaction_rollback</h1>

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.

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.

Sources

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

Source evidence

Evidence belongs to the frozen source and runtime versions listed here. It is not a runtime verification of the selected manual version.

40000 is the transaction_rollback condition in Class 40.

Method: Read the fixed errcodes.txt row and macro mapping.

Limits: This records the protocol definition and does not imply a natural PostgreSQL throw path.

src.errcodes.18.6

transaction aborted during system catalog scan is a source-confirmed path for 40000.

Method: Trace the fixed source call scan and classify the path before selecting a safe runner case.

Limits: No representative runtime case is claimed; the path requires a specialized internal or trigger/procedure context.

src.genam.18.6 src.calls.REL_18_6

Message templates

ERROR · message.catalog-scan-rollback

Primary

transaction aborted during system catalog scan

This is an internal catalog-scan path; ordinary client rollback has no basis to use this template.

Reproduction & repair cases

transaction_rollback_boundary · PG 10, 18

Preconditions

  • A runner-owned disposable target is provisioned.

Trigger: No internal system-catalog-scan fault is injected; the fixed source path remains a source-only boundary.

Expected assertions

    Repair: Treat this umbrella as a transaction rollback outcome only after identifying the concrete source mechanism; do not retry an unknown internal failure blindly.

    Cleanup: Drop the case schema with an owner connection.

    Recorded runtime evidence

    No runtime observation is attached to this entry.

    Definition snapshot: english-manuals:b29958f40cb0d9178f9ce604512… · English manual source