When I try to restore a database using
pg_restore -U username --no-owner --no-privileges -d mydb backupfile.dump
I get an error saying:
pg_restore: error: could not execute query: ERROR: schema "public" already exists Command was: CREATE SCHEMA public;
How do I prevent this error? I looked at another similar question on the site, and tried what was suggested in the answer.
dropdb mydb and
createdb mydb before running the
In case it is relevant, I am trying to restore the database dumped from PostgreSQL 10.14 into a database in PostgreSQL 12.3.