Re: ERROR: could not read block 4707 of relation 1663/16384/16564: Success - Mailing list pgsql-general

From Tom Lane
Subject Re: ERROR: could not read block 4707 of relation 1663/16384/16564: Success
Date
Msg-id 23420.1312209035@sss.pgh.pa.us
Whole thread Raw
In response to Re: ERROR: could not read block 4707 of relation 1663/16384/16564: Success  (Deniz Atak <denizatak@gmail.com>)
List pgsql-general
Deniz Atak <denizatak@gmail.com> writes:
> thanks for your answer. Do you have any opinion about how can I find the
> corrupted rows? Do you know how to read:

> "could not read block 4707 of relation 1663/16384/16564"

You should read the chapter about Database Physical Storage in the
manual to find out how to interpret that as a reference to a specific
block of an operating system file.

In this case, since we believe the problem is a partial block at end of
file, the file size presumably is more than 4707*8K and less than
4708*8K.  If I had to recover from this I would physically truncate the
file to exactly 4707*8K bytes, after saving a copy of the remaining
bytes to see if there's anything useful in there.  (Most likely there's
not --- in particular, if this is the after-effects of an
out-of-disk-space condition that prevented Postgres from filling up a
whole new block, then I'd expect the partial page to be filled with
zeroes.)

On Unix machines you could use dd for that, though I'd strongly
recommend practicing on a scratch file as it's not exactly user
friendly.  Dunno what to use on Windows.

            regards, tom lane

pgsql-general by date:

Previous
From: "Tomas Vondra"
Date:
Subject: Re: ERROR: could not read block 4707 of relation 1663/16384/16564: Success
Next
From: Simon Riggs
Date:
Subject: Re: Error: operator does not exist: integer = integer