Postgresql 9.2 pg_dump version mismatch
I encountered this while using Heroku on Ubuntu, and here's how I fixed it:
Add the PostgreSQL apt repository as described at "Linux downloads (Ubuntu) ". (There are similar pages for other operating systems.)
Upgrade to the latest version (9.3 for me) with:
sudo apt-get install postgresql
Recreate the symbolic link in
/usr/bin
with:sudo ln -s /usr/lib/postgresql/9.3/bin/pg_dump /usr/bin/pg_dump --force
The version number in the
/usr/lib/postgresql/...
path above should match theserver version
number in the error you received. So if your error says,pg_dump: server version: 9.9
, then link to/usr/lib/postgresql/9.9/...
.
Check the installed version(s) of pg_dump:
find / -name pg_dump -type f 2>/dev/null
My output was:
/usr/pgsql-9.3/bin/pg_dump /usr/bin/pg_dump
There are two versions installed. To update pg_dump with the newer version:
sudo ln -s /usr/pgsql-9.3/bin/pg_dump /usr/bin/pg_dump --force
This will create the symlink to the newer version.