Fixing PostgreSQL After Homebrew Upgraded It From 9.1 to 9.2 and I Was Suddenly Unable to Access My Existing Databases
Symptoms
- You just rebooted and suddenly PostgreSQL isn’t responding
- Restarting postgres fails due to a “Your data files are incompatible with the current version of Postgres” error.
Prescription
There’s a utility that comes with Postgres named pg_upgrade
which should sort you out. In order to work it you’ll need to create and initialize a new postgres data directory and then call pg_upgrade
and pass it paths for the old binaries, new binaries, old data directory, and new data directory. Read the script below for an example.