Diagnostic Queries
Symptoms
PostgreSQL could not read the commit status (from the clog / pg_xact)">pg_xact/clog area) for a transaction id it needed. This points to corruption of transaction-status data and raises SQLSTATE XX001 (data_corrupted).
- A DETAIL usually names a missing/short clog file.
- Indicates damage to
pg_xact(commit log) or related SLRU data. - May surface during reads, vacuum, or visibility checks.
What the server log shows
ERROR: could not access status of transaction 1234567
DETAIL: Could not open file "pg_xact/0001": No such file or directory.
Why PostgreSQL raises this — what the manual says
As Section 66.1 Database File Layout explains:
PostgreSQL could not read a transaction’s commit/abort status from the pg_xact (transaction commit log) subdirectory under the data directory — typically a symptom of data corruption or a missing or truncated commit-log segment; investigate disk integrity and recent crashes before continuing.
To decide tuple visibility, PostgreSQL must look up each transaction’s commit status in pg_xact. If that data is missing or unreadable, visibility cannot be determined and it reports XX001.
Common causes
- Corruption or loss of
pg_xact/clog files. - A truncated or improperly restored data directory.
- Transaction-id wraparound damage or storage faults.
How to fix it
- Back up the data directory before attempting recovery.
- Restore from a consistent backup/PITR — the most reliable fix.
- For wraparound issues, ensure aggressive vacuuming; advanced clog repair only under expert guidance (risk of data loss).
Related & next steps
Reference: PostgreSQL 18 Section 76.1 “Database File Layout”.
Thanks — noted. This helps keep the database accurate.