After a server crash one or more of Postgres' files have been corrupted (at least, for now, I will assume it is due to the crash and not due to faulty hardware). The problem seems to be limited to some rows of one quite large table, since we get segfaults querying this table. We tried find_bad_row, but this doesn't work when the server segfaults. If we could just remove the affected rows, this would be fine, since we can re-import the data.

I am currently running a script that just tries querying the table row by row:

select * from table where id = $1;

The question is, once I find a bad row, how do I remove it from the database?

In the log we have a few lines like this after recovering from the segfault:

record with zero length at 765/2C27A1C0

Is this relevant to the problem?


Deleting the affected rows works. Good enough for me in this case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.