How to downgrade a postgres database from version 10 to 9.1?

3.4k Views Asked by At

I have a system that only supports version 9.1 of postgres and a client (company) has been managing their data with version 10. There are many tables and I need to know if there is a script to downgrade the database from version 10 to 9.1 . Thanks in advance!

1

There are 1 best solutions below

4
On

As other commenters have already stated, PostgreSQL 9.1 is long obsolete, and this is a bad idea in general. However, to answer your question, you would have to dump the data with pg_dump into plain SQL statements using the latest pg_dump utility from PG 10.

pg_dump --column-inserts

which will produce a plain text file that can be restored back to 9.1 using the psql utility from 9.1. It will be super slow and painful, as it should be when you are going in the decidedly wrong direction. A better answer would be to figure out why 9.1 is necessary, as @adrian.klaver mentions.

Yes, @AdrianKlaver is correct. Any new features will break the transfer.