Migration of data from PostgreSQL 9.1.13 to PostgreSQL 9.3

Posted November 6, 2015 4.2k views

Hello there,

I have the following issue. I have database PostgreSQL version 9.1. I have a second server with PostgreSQL 9.3. I want to move the data from PostgreSQL 9.1 to PostgreSQL 9.3. For that purpose I dumped the data from PostgreSQL 9.1 using the following command:

pg_dump -U postgres -Ft -p 5432 DB_NAME > DUMP_FILE_NAME.bkp.tar

And then I restored it to PostgreSQL 9.3:

pg_restore -U postgres -p 5432 -v -c -O -d NEW_DB_NAME DUMP_FILE_NAME.bkp.tar

The issue is that not the whole data was restored. Part of the tables were missing, a significant part of the functionalities, etc.

So, I have a question, is it possible to migrate the whole data somehow?

I also tried to install PostgreSQL 9.1 on the seconds server but PostgreSQL no longer supports version 9.1. That’s why it was necessary to do that with the help of the source code from here:

Then I followed the instructions:

and few other articles on Internet. Result…nothing. I can’t tun PostgreSQL 9.1 using its source code. Can you please help?


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

The key to migrating data from one major version of PostgreSQL to another is to you the pg_dump binary from the new version to dump the data from the old one. As mentioned in the PostgreSQL 9.3 upgrade docs:

It is recommended that you use the pg_dump and pg_dumpall programs from the newer version of PostgreSQL, to take advantage of enhancements that might have been made in these programs. Current releases of the dump programs can read data from any server version back to 7.0.

While using pg_dump is the recommended route, if you are upgrading in place the pg_upgrade command is also useful. See more here.