Read more

Restoring old Postgres dumps with pg_restore v11 and higher

Avatar
Claus-Theodor Riegg
October 16, 2019Software engineer at makandra GmbH

There is an issue with when restoring a PostgreSQL dump created with pg_dump < v11 with pg_restore > v10:

pg_restore: [archiver (db)] could not execute query: ERROR:  schema "public"
already exists
    Command was: CREATE SCHEMA public;

Convert

Illustration online protection

Rails professionals since 2007

Our laser focus on a single technology has made us a leader in this space. Need help?

  • We build a solid first version of your product
  • We train your development team
  • We rescue your project in trouble
Read more Show archive.org snapshot

If you want to restore this dump you should convert the dump to the text format first and comment out the CREATE SCHEMA public;` statement. For further information see linked content.

Use different pg_restore

After adding the PostgreSQL APT respository Show archive.org snapshot you can install additional client versions on your local machine with apt install postgresql-client-$VERSION. You'll find them here: /usr/lib/postgresql/$VERSION/bin/pg_restore.

Posted by Claus-Theodor Riegg to makandra Operations (2019-10-16 14:17)