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.
source share