Postgresql 9.2 pg_dump version mismatch

Chris Colla picture Chris Colla · Oct 11, 2012 · Viewed 227.2k times · Source

I am trying to dump a Postgresql database using the pg_dump tool.

$ pg_dump books > books.out

How ever i am getting this error.

pg_dump: server version: 9.2.1; pg_dump version: 9.1.6
pg_dump: aborting because of server version mismatch

The --ignore-version option is now deprecated and really would not be a a solution to my issue even if it had worked.

How can I upgrade pg_dump to resolve this issue?

Answer

Seth picture Seth · Apr 8, 2014

I encountered this while using Heroku on Ubuntu, and here's how I fixed it:

  1. Add the PostgreSQL apt repository as described at "Linux downloads (Ubuntu) ". (There are similar pages for other operating systems.)

  2. Upgrade to the latest version (9.3 for me) with:

    sudo apt-get install postgresql
    
  3. 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 the server 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/....