postgresqlubuntu-14.04database-backupspostgresql-9.4pg-dump

pg_dump: aborting because of server version mismatch


I am running ubuntu 14.04. while backing up a database on postgreSQL i am following error:

/usr/bin/pg_dump --host 127.0.0.1 --port 5432 --username "postgres" --no-password  --format custom --section pre-data --section data --section post-data --verbose --file "/home/naveen/consumerDB/CONSUMER_DB" "CONSUMER_DB"
pg_dump: server version: 9.4.8; pg_dump version: 9.3.17
pg_dump: aborting because of server version mismatch

Process returned exit code 1.

Can anyone please help. I tried many other stack overflow links but nothing seems to be working.


Solution

  • The error message seems fairly clear. pg_dump for PostgreSQL 9.3 won't dump a PostgreSQL 9.4 database. Maybe you need to run pg_dump from PostgreSQL 9.4?

    If you installed both from packages you'll be using pg_wrapper and should use Debian/Ubuntu's update-alternatives to change pg_dump to point to 9.4's pg_dump. Or run it via the direct path to the actual binary.

    See also https://help.ubuntu.com/community/PostgreSQL