Antoine Pous
Antoine Pous

Reputation: 21

pg_restore | Restore all schema

Currently I have a database dump, for some testing purpose sometimes i need to import the production DB locally.

For an unknown reason when i run $ pg_restore --verbose --clean --no-acl --no-owner -U 'root' --host=localhost --dbname=db_local ./db_prod.dump schema are not created. Instead i have those logs.

postgres_1 | 2022-02-01 11:48:07.402 UTC [103] ERROR: schema "abuse" does not exist

postgres_1 | 2022-02-01 11:48:07.402 UTC [103] STATEMENT: DROP SCHEMA abuse;

So currently i'm stuck, 'cause i really don't know and don't find any solution for this issue.

Upvotes: 2

Views: 4785

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 247340

This error is caused by the --clean option: pg_restore tries to drop the object before creating it.

Either ignore the harmless error message or use the --if-exists option to suppress it.

Upvotes: 2

Related Questions