Wrong version of pg_dump on Ubuntu

Solution 1:

Turns out that installing the 9.3 client does not auto uninstall the 9.2 client, and if they're both on the machine like this, then that's what you get. The answer is to remove the postgresql-client-9.2 (or whatever the appropriate old version is in your case).

Solution 2:

you may want to check output of the command

dpkg -l | grep postgres

to see which versions are installed and active pg_dump is usually part of postgresql-client-common package.

(And edit your question, It is not clear how did you upgrade from version 9.3 to 9.3 ... )


Solution 3:

I was also facing same issue. First, I removed old pgdump versions. Mostly it is part of postres-client. So, remove them by using

apt-get remove postgresql-client-common

Install the version as per your requirement, by executing following commands. I am using ubuntu 16.04. Replace, "xenial" by your ubuntu version, in the first command. Command to check ubuntu version-
cat /etc/os-release

$ echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" > /etc/apt/sources.list.d/pgdg.list
$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
$ sudo apt-get update
$ apt-cache search postgresql | grep postgresql-client
$ apt-get install postgresql-client-9.5


Solution 4:

I managed to fix my issues by uninstalling the postgresql client

sudo apt-get remove postgresql-client-common

And then re-installing

  sudo apt-get install postgresql-client-11

Solution 5:

If you need to have several versions of postgresql client same time you may use

pg_dump --cluster 9.2/main [other pg_dump options]

for old cluster and

pg_dump --cluster 9.3/main [other pg_dump options]

for new

View accepted answer on askubuntu for details: https://askubuntu.com/a/647341/1044581