Repairing broken PostgreSQL databases / tables

If your server happened to crash, PostgresSQL database is corrupted, but didn’t contain too precious information, you may try the following fix.

The typical symptoms of a corrupted Postgres database would be like below:

or

The actual fix is quite easy, and basically sets “zero_damaged_pages = on”, then performs vacuum and reindexing.