4

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?

Konrad Garus
  • 53,145
  • 43
  • 157
  • 230
  • possible duplicate of [Use pg\_restore to restore from a newer version of PostgreSQL](http://stackoverflow.com/questions/4599696/use-pg-restore-to-restore-from-a-newer-version-of-postgresql) – Dana the Sane May 09 '13 at 14:24

1 Answers1

14

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).

jmz
  • 5,399
  • 27
  • 29
  • For the record - plain text pg_dump dumps `CREATE OR REPLACE PROCEDURAL LANGUAGE plpgsql` while 8.3 only supports `CREATE LANGUAGE plpgsql`. – Konrad Garus Apr 05 '11 at 17:13