I was starting a new project and wanted to pull a pg backup from heroku to fix a bug.
➜ review_sys git:(bugfix/33-numeric-updats) heroku pg:pull DATABASE_URL xyz_dev --remote production
heroku-cli: Pulling postgresql-vertical-abcdefg ---> xyz_dev
pg_dump: server version: 9.6.1; pg_dump version: 9.5.5
pg_dump: aborting because of server version mismatch
pg_restore: [archiver] input file is too short (read 0, expected 5)
Given you have postgres 9.5 installed in an Ubuntu 16.04 system, and assuming you have postgres 9.6 installed, this is how you can upgrade your postgres cluster to the new version.
sudo pg_dropcluster 9.6 main --stop
sudo pg_upgradecluster 9.5 main
sudo pg_dropcluster 9.5 main
If you are wondering, no you don't need to do any thing else, like stopping any active apps. But if you are upgrading on a production server, it will be a good idea to switch to a "maintanance mode" with a frindly message, just incase.