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



Solution 1:[1]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Laurenz Albe