↑↓ select↵ open⌫ change scopeOpen full search

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

Wiki / SQLSTATE

40000 — transaction_rollback

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.

English manual coverage begins with PostgreSQL 8.1. Source history and runtime observations have their own recorded version boundaries.

Reading PG 18·Select a recorded version

aliases
Unknown
class name
Transaction Rollback
condition name
transaction_rollback
lang
en
sqlstate
40000

Definition PG 18

40000 — transaction_rollback

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

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

Sources {#sources}

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

Compare versions

SQLSTATE evidence and recorded runtime versions

cases · transaction_rollback_boundary
{
  "assertions": [],
  "case_id": "transaction_rollback_boundary",
  "cleanup": "Drop the case schema with an owner connection.",
  "has_snippet": false,
  "position": 0,
  "preconditions": [
    "A runner-owned disposable target is provisioned."
  ],
  "repair": "Treat this umbrella as a transaction rollback outcome only after identifying the concrete source mechanism; do not retry an unknown internal failure blindly.",
  "trigger": "No internal system-catalog-scan fault is injected; the fixed source path remains a source-only boundary.",
  "versions": [
    "10",
    "18"
  ]
}
claims · identity
{
  "claim_id": "identity",
  "limits": "This records the protocol definition and does not imply a natural PostgreSQL throw path.",
  "method": "Read the fixed errcodes.txt row and macro mapping.",
  "position": 0,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "40000 is the transaction_rollback condition in Class 40."
}
claims · source-boundary
{
  "claim_id": "source-boundary",
  "limits": "No representative runtime case is claimed; the path requires a specialized internal or trigger/procedure context.",
  "method": "Trace the fixed source call scan and classify the path before selecting a safe runner case.",
  "position": 1,
  "runtime": [],
  "sources": [
    "src.genam.18.6",
    "src.calls.REL_18_6"
  ],
  "statement": "transaction aborted during system catalog scan is a source-confirmed path for 40000."
}
messages · message.catalog-scan-rollback
{
  "limits": "This is an internal catalog-scan path; ordinary client rollback has no basis to use this template.",
  "message_id": "message.catalog-scan-rollback",
  "path": "",
  "position": 0,
  "raw": {
    "id": "message.catalog-scan-rollback",
    "limits": "This is an internal catalog-scan path; ordinary client rollback has no basis to use this template.",
    "primary_template": "transaction aborted during system catalog scan",
    "severity_source": "ERROR",
    "sources": [
      "src.genam.18.6"
    ],
    "sqlstate": "40000"
  },
  "severity": "ERROR",
  "sources": [
    "src.genam.18.6"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "transaction aborted during system catalog scan",
      "position": 0,
      "role": "",
      "template": "transaction aborted during system catalog scan"
    }
  ]
}
sources · src.errcodes.18.6
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/utils/errcodes.txt",
  "position": 0,
  "sha256": "6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba",
  "source_id": "src.errcodes.18.6",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt"
}
sources · src.calls.REL_18_6
{
  "commit": "",
  "docs_url": "",
  "kind": "local_artifact",
  "location": "",
  "path": "raw/calls/REL_18_6.jsonl",
  "position": 1,
  "sha256": "9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf",
  "source_id": "src.calls.REL_18_6",
  "tag": "",
  "url": ""
}
sources · src.genam.18.6
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/access/index/genam.c",
  "position": 2,
  "sha256": "11897b1d8b1ae1f4a1bef9a72e740da7aa83579abf84e4ca5ebacd6530874c28",
  "source_id": "src.genam.18.6",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/index/genam.c#L496-L498"
}

Source references

Full definition and evidence JSON

Definition sources

center · PostgreSQL 18 · english-manuals:88fa22a579371b5d23925809df8eada17ceba2b46dbd459ffbcd0dfeeee1d089

Text language: en · english-manuals:88fa22a579371b5d23925809df8eada17ceba2b46dbd459ffbcd0dfeeee1d089