We just upgraded our PostgreSQL servers to v13. We heavily use pg_dump on Ubuntu 18 systems to transfer data between databases. After upgrading the servers, pg_dump would complain about a version mismatch.
Easy enough, I installed the postgres-client-13 from the Apt Postgres repo (http://apt.postgresql.org/pub/repos/ap). pg_dump would still complain about a version mismatch so I uninstalled postgresql-client-11. After that pg_dump would complain that "PostgreSQL version 11 is not installed".
No amount or ordering of reinstalling and removing PostgreSQL clients clears up this error. Can anyone point me in the right direction to solving this issue?
I just ran into this exact problem myself just now. I'm on Debian 10, although it doesn't seem like there should be anything really different for you, since I also used the PostgreSQL apt repository to upgrade from version 11.
If you run
file $(which pg_dump)
, you should see that it's just actually a symbolic link to/usr/share/postgresql-common/pg_wrapper
. It turns out this is just a perl script that calls the appropriate version of the utility, depending on the Postgres versions you have installed.Since we both did the same thing, I'm going to guess that if you look at your
postgresql.conf
file, in/etc/postgresql/13/main/
, the port is going to be set to5433
instead of the default5432
. This seems to be the root of the problem.I simply had to change the port setting back to the usual
5432
and restart the postgres service, and now everything works as expected.I actually experimented with setting the
PGSERVICE
,PGHOST
, andPGPORT
variables via the command-line in the call tocreatedb
and other utilities that callpg_wrapper
, but I kept getting a prompt for a password, which is odd, because I was running everything as thepostgres
user. For now I'm just calling that a mystery to be explored at some later time in the future.