Diagnostic Queries
Symptoms
PostgreSQL read fewer bytes than expected for a data block, indicating a truncated/short read. PostgreSQL raises SQLSTATE 58030 (io_error).
- A block read returned fewer bytes than a full page.
- Often a truncated file or failing storage.
- Signals possible corruption or hardware trouble.
What the server log shows
ERROR: could not read block 12345 in file "base/16384/24576": read only 0 of 8192 bytes
Why PostgreSQL raises this — what the manual says
As Section 28.6 WAL Internals explains:
A read of a specific data or WAL block failed, typically signalling underlying storage corruption or an I/O fault; the block could not be retrieved from the relation file at the expected offset.
Data files are read in fixed 8 KB pages. A short read (fewer bytes than a page) means the file is truncated or the storage failed, so PostgreSQL reports 58030.
Common causes
- A truncated relation file (e.g. from a botched restore/copy).
- Failing disk or filesystem returning short reads.
- Out-of-band file tampering in the data directory.
How to fix it
- Investigate storage/filesystem health immediately.
- Restore the affected relation/database from a known-good backup.
- Never manually edit files in the data directory.
Related & next steps
Reference: PostgreSQL 18 Section 30.5 “WAL Internals”.
Thanks — noted. This helps keep the database accurate.