How to restore postgres 12 dump file into postgres 11.5

Viewed 4335

dump file generated by pg_dump command in postgres 12

command i use in postgres 11.5:

pg_restore -h [host] -p 5432 -U postgres -d [db] -1 backup.dump

error message:

pg_restore: error: could not set default_table_access_method: ERROR:  unrecognized configuration parameter "default_table_access_method"

Is it possible to restore it? please advice.

2 Answers

default_table_access_method is not available in pg11. So the workaround is to take a plain dump of source database and remove the following given below entry from your backup.dump file

SET default_table_access_method = heap;

After that use the below command for restoring the dump on target pg1

Disclosure: I work for EnterpriseDB (EDB)

It seems that only pg_restore throws an error, psql just issues a warning. So you could convert your binary dump to text:

pg_restore dumpfile.Fc -f- | psql -U user -d database

This worked for me on linux.

Related