Tarun Garg
Tarun Garg

Reputation: 25

Can we import pg_dump from PostgreSQL 9.5 into 9.4.5

I am new to PostgreSQL.

I have a PostgreSQL 9.4.5 database set up on my machine and there I have imported a lot of tables.

I want to add one more database to it. So I have taken the dump of that database from one of the existing PostgreSQL on a VM.

I have the suspicion that the VM from which the dump has been taken has PostgreSQL version 9.5, and the VM to which I want to import has 9.4.5 .

I had a personal VM where I also had PostgreSQL 9.4.5 and there for testing I tried to import a PostgreSQL 9.5 dump.

There I got an error

ERROR:  unrecognized configuration parameter "row_security"

Now I figured it is because of the statement

SET row_security = off;

inside my backup file. I tried once more removing this line from the backup file and creating one more test DB on my testing VM. Then I didn't get the above error.

So I have doubt that should I be removing such lines and using the back up or it can have some bad effects also so I should not be doing so.

Upvotes: 0

Views: 736

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 247330

There is no supported way to “downgrade” a PostgreSQL database.

You would have to edit the dump with a text editor and adapt everything that is supported in 9.5 but not in 9.4, just like you did. There is no better way to do it.

For example, the row_security parameter was introduced in 9.5, so you'd have to remove it.

If your 9.5 database uses some feature not available in 9.4, you are in trouble.

Upvotes: 1

Related Questions