I'm attempting to upgrade my local instance of postgres to 10.1 (from 9.6.6) on macOS. Using this gist as a guide, I've encountered a problem when running pg_upgrade. Here are the steps taken:

$ mv /usr/local/var/postgres /usr/local/var/postgres.old

$ mkdir /usr/local/share/postgresql.old
$ cp -r /usr/local/share/postgresql/timezone /usr/local/share/postgresql.old
$ cp -r /usr/local/share/postgresql/timezonesets /usr/local/share/postgresql.old

$ initdb /usr/local/var/postgres -E utf8

$ pg_upgrade \
  -d /usr/local/var/postgres.old/ \
  -D /usr/local/var/postgres/ \
  -b /usr/local/Cellar/[email protected]/9.6.6/bin \
  -B /usr/local/Cellar/postgresql/10.1/bin/

Performing Consistency Checks
Checking cluster versions
Old cluster data and binary directories are from different major versions.
Failure, exiting

Prior to this attempted upgrade, 9.6.6 was running perfectly with /usr/local/var/postgres as its data directory. Why does pg_upgrade think the old data does not match the old binaries?

Edit: Here's the output requested by @jjanes:

$ /usr/local/Cellar/[email protected]/9.6.6/bin/pg_ctl start -D /usr/local/var/postgres.old
server starting
FATAL:  database files are incompatible with server
DETAIL:  The data directory was initialized by PostgreSQL version 9.5, which is not compatible with this version 9.6.6.

I had assumed 9.* was considered the same "major version", as per semver. Apparently not; upgrading from 9.5.10 worked perfectly.

  • Try /usr/local/Cellar/[email protected]/9.6.6/bin/pg_ctl start -D /usr/local/share/postgresql.old and let us know what error you get.
    – jjanes
    Nov 28, 2017 at 18:58


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.