Hi hackers, Postgres determines the availability of the main fork, the actual data file, upon reading it. This is also what amcheck will detect.
However, if a relation exceeds 1GB and has more than a single data file segment, there is the option of silent data loss. For example, if a table consists of five segments and the third one goes missing, a sequential scan will happily conclude that the table consists only of two segments and won't report an error. Only an index scan that tries to return a row in the missing segment will report an error. Currently, this kind of data loss cannot be detected if you check the integrity of the table using verify_heapam(). Only if you manually use the primary key index to obtain data from a missing segment, you will get an error. Therefore, I would like to request an enhancement: add an option to verify_heapam() that causes the primary key index to be scanned and makes sure that all line pointers in the index point to existing tuples. An alternative might be to track the number of segments of a relation in pg_class, but that may be difficult to make crash-safe. Frits Hoogland
