I am creating pg dump of a database using following command:
pg_dump mydatabase -Fc -c -U mydatabaseuser -f mydatabase_pgdump_$(date +^CY%m%dT%H%M")
Then i am trying to to restore that dump using following:
pg_restore -d mydatabase -U postgres mydatabase_pgdump_20230422T0540
However, this gives me a lot of object already exists
errors, such as:
pg_restore: error: could not execute query: ERROR: relation "user_token" already exists
The destination database is already there, however I have include -c --clean
in my pg_dump
command, so shouldn't all the existing object first dropped and then recreated? Or i am missing something?