Why am I seeing a server version mismatch error when restoring a Postgres database with pg_dump?

Issue

You are seeing a similar error in your console when attempting to restore a Postgres database or when using sql based schema dumps in Rails:

pg_dump: server version: 9.6.1; pg_dump version: 9.5.6
pg_dump: aborting because of server version mismatch

Resolution

Postgres utilities such as pg_dump are not guaranteed to be forward compatible. Thus if the version of pg_dump used to create the dump file is older than the Postgres version of the target database then you will be unable to complete the restore. There are two solutions.

  • Downgrade the target Postgres version to match that version which created the dump.
  • Upgrade the source Postgres version to match the target Postgres version and re-create the dump file .

During major Postgres version upgrades (e.g. https://devcenter.heroku.com/changelog-items/1568) it may take time before all dyno images have received the updated Postgres client libraries. If this is causing issues with Review Apps or CI tests you can specify an older Postgres version for newly provisioned databases in the addons section of the app.json file as described here: https://devcenter.heroku.com/articles/app-json-schema#addons

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support
Terms of Service Privacy Cookies © 2019 Salesforce.com