Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pg_dump 9.0 to pg_restore 8.3

Is it possible to instruct pg_dump of 9.0 to provide a backward-compatible dump, or force pg_restore of 8.3 to work with that dump?

In other words, what are my options in resolving this error on restoring dump made with 9.0 with pg_restore 8.3:

pg_restore: [archiver] unsupported version (1.12) in file header

What are the possible caveats of this dump/restore version conflict?

like image 822
Konrad Garus Avatar asked Dec 12 '22 14:12

Konrad Garus


1 Answers

Create a plain text dump:

pg_dump mydb > db.sql
psql -d newdb -f db.sql

This should work OK, as it stores no version information, and uses plain SQL format in the dump. The data is restored with COPY so it's fast. If you've used some 9.0 features in the DB, then you'll have to manually edit the schema in the dump to make it work on 8.3. Blobs may not survive this format however; I've not tested that).

like image 199
jmz Avatar answered Jan 31 '23 01:01

jmz