Search code examples
postgresqlpg-dump

How to fix pg_dump: aborting because of server version mismatch


My codebase and database is hosted on different servers with Ubuntu 12.04.

database => web1

codebase => web2

I am trying to take my database backup (web1) through the application(web2).

Now the problem is I have different versions of postgres installed on web1 and web2.

pg_dump: server version: 9.3.12 (web1)

pg_dump version: 9.1.23 (web2)

Is there any way I can resolve this issue without upgrading any package because there are multiple applications hosted and relying on these versions.

Thanks for helping!


Solution

  • pg_dump will refuse to connect to a server with a later version than itself for the good reason that it cannot guarantee that it will work.

    Downgrading a database from 9.3 to 9.1 is definitely not supported, particularly since version 9.1 is out of support.

    You'll have to use pg_dump from the 9.3 installation to dump the database, then you can try to load the result into the 9.1 database. Watch out for errors during restore and test well!