3

What could be the cause of this? See the error below.

pg_dump: server version: 9.6.1; pg_dump version: 9.5.5
pg_dump: aborting because of server version mismatch

However, when I investigate:

peter@Peters-MacBook-Pro:~$ psql --version
psql (PostgreSQL) 9.6.1
peter@Peters-MacBook-Pro:~$ pg_dump --version
pg_dump (PostgreSQL) 9.6.1

The two versions are equal.

Additional commands:

peter@Peters-MacBook-Pro:~$ find / -name pg_dump -type f 2>/dev/null
/Applications/pgAdmin3.app/Contents/SharedSupport/pg_dump
/Applications/Postgres-9.6.1.0-2.app/Contents/Versions/9.6/bin/pg_dump
/Applications/Postgres-9.6.1.0.app/Contents/Versions/9.6/bin/pg_dump
/Applications/Postgres.app/Contents/Versions/9.6/bin/pg_dump

peter@Peters-MacBook-Pro:~$ which postgres
/Applications/Postgres.app/Contents/Versions/latest/bin/postgres

peter@Peters-MacBook-Pro:~$ which pg_dump
/Applications/Postgres.app/Contents/Versions/latest/bin/pg_dump
Someguywhocodes
  • 781
  • 5
  • 17
  • 1
    Possible duplicate of [Postgresql 9.2 pg\_dump version mismatch](http://stackoverflow.com/questions/12836312/postgresql-9-2-pg-dump-version-mismatch) – vabada Feb 13 '17 at 19:31
  • @vabada I have no ```/usr/bin/pg_dump``` folder which seems to be the root issue in the other thread. – Someguywhocodes Feb 13 '17 at 19:46
  • Did you execute the pg_dump command that resulted in an error yourself on the commandline or was it executed by some other program like pgAdmin? pgAdmin for instance has a `binary paths` setting that controls which instance it runs. – Eelke Feb 13 '17 at 20:09
  • 1
    IOS has a history of leaving old versions of binaries in the path. Try to use the newest version (possibly in the same */bin/* directory as your postgres DBMS server. -->> use an absolute pathname to call the binary. – wildplasser Feb 13 '17 at 22:18
  • @wildplasser Could you expand on this answer please? I'm not too sure how to go about "trying to newest version". – Someguywhocodes Feb 14 '17 at 15:59

1 Answers1

1

To answer was to run:

/Applications/Postgres.app/Contents/Versions/latest/bin/pg_dump db_name > db.out

The path used came from by looking at the result of:

which postgres
>/Applications/Postgres.app/Contents/Versions/latest/bin/postgres

I then was able to run the correct version pg_dump

Someguywhocodes
  • 781
  • 5
  • 17