I have a Postgres 9.6 database that is corrupted. The hardware it was running on went bad, and there is at least one corrupted page in the DB. When running pg_dump I get the following error:
pg_dump: WARNING: page verification failed, calculated checksum 24925 but expected 25309
pg_dump: Dumping the contents of table "my_table" failed: PQgetResult() failed.
pg_dump: Error message from server: ERROR: invalid page in block 250471 of relation base/16384/754450
This particular table is easy to fix even if data is missing, so what I'd like to do is to zero out that page entirely and continue with the DB. But I could not find a way on how to do that, how do I tell Postgres to ignore the error, delete the data in that page and go on? pg_dump itself doesn't seem to have an option like this.
I also would like to know if there are more checksum errors, but the tool I found for this is only present since Postgres 11 and not in my older version.
How do I fix the bad pages by removing all the data in them, so that the database can continue to run and pg_dump can run again?