Psql and pg_dump version mismatch

omnia@ubuntu :~$ psql --version psql (PostgreSQL) 9.3.4 omnia@ubuntu :~$ pg_dump --version pg_dump (PostgreSQL) 9.2.8 omnia@ubuntu :~$ dpkg -l | grep pg ii gnupg 1.4.11-3ubuntu2.5 GNU privacy guard - a free PGP replacement ii gpgv 1.4.11-3ubuntu2.5 GNU privacy guard - signature verification tool ii libgpg-error0 1.10-2ubuntu1 library for common error values and messages in GnuPG components ii libpq5 9.3.4-1.pgdg60+1 PostgreSQL C client library ii pgdg-keyring 2013.2 keyring for apt.postgresql.org ii postgresql-9.2 9.2.8-1.pgdg60+1 object-relational SQL database, version 9.2 server ii postgresql-9.3 9.3.4-1.pgdg60+1 object-relational SQL database, version 9.3 server ii postgresql-client-9.2 9.2.8-1.pgdg60+1 front-end programs for PostgreSQL 9.2 ii postgresql-client-9.3 9.3.4-1.pgdg60+1 front-end programs for PostgreSQL 9.3 ii postgresql-client-common 154.pgdg60+1 manager for multiple PostgreSQL client versions ii postgresql-common 154.pgdg60+1 PostgreSQL database-cluster manager ii python-gnupginterface 0.3.2-9.1ubuntu3 Python interface to GnuPG (GPG) ii unattended-upgrades 0.76ubuntu1 automatic installation of security upgrades ii update-manager-core 1:0.156.14.13 manage release upgrades omnia@ubuntu :~$ 

It seems I have both installed, but pg_dump is stuck in the old version? It’s strange, since both are associated with the same β€œwrapper”:

 omnia@ubuntu :~$ readlink /usr/bin/psql ../share/postgresql-common/pg_wrapper omnia@ubuntu :~$ readlink /usr/bin/pg_dump ../share/postgresql-common/pg_wrapper 

What am I doing wrong?

+6
source share
3 answers
 sudo rm /usr/bin/pg_dump sudo ln -s /usr/lib/postgresql/9.3/bin/pg_dump /usr/bin/pg_dump 
+13
source

If your pg_dump has a sim connection with pg_wrapper, the best solution is to tell pg_wrapper which version to use.

Append

 * * 9.6 localhost:5432 * 

to /etc/postgresql-common/user_clusters (if your postmaster is listening on /etc/postgresql-common/user_clusters : 5432, of course).

This then fixes the problem for all pg_ commands, does not include breaking anything, and scales well for future versions that you might want to install.

See man pg_wrapper and man postgresqlrc more details.

NB This answer definitely applies to Debian / Ubuntu and is most likely applicable when there are two versions of pg, for example. after update.

+1
source

The suffix for the pgdg60 package makes me think that these packages are not from the official Ubuntu repository. Try finding /etc/apt/sources.list or /etc/apt/sources.list.d and see if you have PPAs or third party repositories.

Try to get Postgresql packages either from your Ubuntu repository (although they may be a bit dated depending on your version of Ubuntu) or from the official Postgres repo (they provide an apt server for Ubuntu / Debian): https: //wiki.postgresql. org / wiki / Apt

0
source

Source: https://habr.com/ru/post/969663/


All Articles