Investigation
Symptoms
A statement failed with SQLSTATE XX001 (data_corrupted), reported at severity ERROR. This is a Internal Error condition: PostgreSQL emits the message could not read from log segment …, offset n: read n of n.
- The client receives SQLSTATE
XX001(data corrupted). - The operation is rejected at
ERRORlevel; the statement does not complete.
What the server log shows
ERROR: could not read from log segment …, offset n: read n of n
Why PostgreSQL raises this
Class XX (Internal Error) indicates a condition that should not normally occur — often a sign of data corruption or a server bug. These warrant careful investigation.
As described in PostgreSQL’s Chapter 30 Reliability and the Write-Ahead Log and Appendix A (PostgreSQL Error Codes), SQLSTATE XX001 carries the condition name data_corrupted in class Internal Error. (Paraphrased — see the linked reference for the exact wording.)
Common causes
- Data or index corruption (often storage/hardware related).
- An unexpected internal state or a server bug.
- A failed consistency check during execution.
How to fix it
- Capture the full message, context, and server version.
- Check storage/hardware and recent crash history.
- Take a backup and consider reporting a reproducible case upstream.
Version applicability
This message text is present in PostgreSQL 15.
Related & next steps
Reference: PostgreSQL Chapter 30 Reliability and the Write-Ahead Log.
Related & next steps
Concepts on this page
Thanks — noted. This helps keep the database accurate.