Postgresql – Restore Postgres Database on New Machine


Trying to restore a postgres database on a new Macbook Pro. I recreated the database using createdb dbname then tried to restore the old database using psql dbname < dbname_dump.bin but ended up with a bunch of errors like ERROR: relation "comments" already exists and ERROR: duplicate key value violates unique constraint "comments_pkey". What's up?

Best Answer

Try dumping the database, recreating, verifying it's empty, and re-importing? If it does it again then check the actual file you're importing and see if it has everything listed 2x.