backup – Postgresql 9.2 pg_dump version mismatch

backup – Postgresql 9.2 pg_dump version mismatch

I encountered this while using Heroku on Ubuntu, and heres 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/....

  1. Check the installed version(s) of pg_dump:

    find / -name pg_dump -type f 2>/dev/null
    
  2. My output was:

    /usr/pgsql-9.3/bin/pg_dump
    /usr/bin/pg_dump
    
  3. 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.

backup – Postgresql 9.2 pg_dump version mismatch

Macs have a builtin /usr/bin/pg_dump command that is used as default.

With the postgresql install you get another binary at /Library/PostgreSQL/<version>/bin/pg_dump

Leave a Reply

Your email address will not be published.