I installed postgresql via Homebrew.
I have the following issue after upgrading:
FATAL: database files are incompatible with server
DETAIL: The data directory was initialized by PostgreSQL version 9.0, which is not compatible with this version 9.1.2.
Any tips on how to upgrade? I tried the following:
$ pg_upgrade -d /usr/local/var/postgres/ -D /usr/local/var/postgres -b
/usr/local/Cellar/postgresql/9.0.4/bin -B /usr/local/Cellar/postgresql/9.1.2/bin
It didn't work. Here's the output.
Performing Consistency Checks
Checking current, bin, and data directories ok
Checking cluster versions
This utility can only upgrade to PostgreSQL version 9.1.
Failure, exiting
error.
For me on OS X with Homebrew it was like this.
mv /usr/local/var/postgres /usr/local/var/postgres.old
initdb -D /usr/local/var/postgres
pg_upgrade -b /usr/local/Cellar/postgresql/9.0.4/bin -B /usr/local/Cellar/postgresql/9.1.2/bin -d /usr/local/var/postgres.old -D /usr/local/var/postgres
./delete_old_cluster.sh
(this script is created for you automatically in current dir when you go through above steps)rm delete_old_cluster.sh
If you’re on macOS and installed Postgres via Homebrew you can simply run:
This will ensure that the old Postgres version is installed, create a new database, and then migrate it via
pg_upgrade
. The old data will remain in/usr/local/var/postgres.old
.Here's how I did it on fedora:
postgresql-setup initdb
this will create a new data directorypg_upgrade -b /usr/lib64/pgsql/postgresql-9.0/bin/ -B /usr/bin/ -d data.old/ -D data
I think for you that would be:
I missed/forgot the "initdb" line
initdb -D /usr/local/var/postgres
After the DB was created, the pg_upgrade worked on my windows system.
For Arch Linux, there is a solution in the wiki that worked fine for me: