I hoped it’d be as simple as a `brew install postgresql`
And it almost was.
RudiMac:merlot matthew$ tail -f /usr/local/var/postgres/server.log FATAL: database files are incompatible with server DETAIL: The data directory was initialized by PostgreSQL version 8.4, which is not compatible with this version 9.0.3.
How do I fix the data files?
Turns out there is a `pg_update` method to do this for you.
But it requires a bit of manual work.
# First of all stop the server launchctl unload -w ~/Library/LaunchAgents/org.postgresql.postgres.plist # backup the old data directory mv /usr/local/var/postgres /usr/local/var/postgres.old # now create a fresh postgres 9 data directory initdb /usr/local/var/postgres
Now we’re ready to do the upgrade.
pg_upgrade -d /usr/local/var/postgres.844/ -D /usr/local/var/postgres -b /usr/local/Cellar/postgresql/8.4.4/bin -B /usr/local/Cellar/postgresql/9.0.3/bin ... Upgrade complete ----------------
Now just add the launch control back in and we’re off.
cp /usr/local/Cellar/postgresql/9.0.3/org.postgresql.postgres.plist ~/Library/LaunchAgents launchctl load -w ~/Library/LaunchAgents/org.postgresql.postgres.plist