I do a pg_dump from RDS, this dump need to restore en local develop context
psql -U postgres -d devDDB -f /tmp/prodDDBB.sql
and too many errors jump, like:
psql:/tmp/prodDDBB.sql:123255: ERROR: duplicate key value violates unique constraint "operation_keys_pkey"
DETAIL: Key (id)=(1088) already exists.
psql:/tmp/prodDDBB.sql:226882: ERROR: relation "brands_vehicles_account_index" already exists
this is normal on a restore operation? the database already exist, i guess this s normal.
1 Answer 1
use
-c
--clean
Output commands to clean (drop) database objects prior to outputting the commands for creating them. (Unless --if-exists is also specified, restore might generate some harmless error messages, if any objects were not present in the destination database.)
This option is only meaningful for the plain-text format. For the archive formats, you can specify the option when you call pg_restore.
see manual
so that all elemenst are dropped before you restore the database.
in your case use pg_restore
with the same parameter, that has the same effect
-
@JorgeMansoN please accept te answer if it was helpfulnbk– nbk2020年11月11日 15:24:10 +00:00Commented Nov 11, 2020 at 15:24
-
i still can't vote, but i can accept the solutionJorge MansoN– Jorge MansoN2020年11月11日 15:33:43 +00:00Commented Nov 11, 2020 at 15:33
-
you need 15 rep for that, keep up and you will quickly reach itnbk– nbk2020年11月11日 16:36:23 +00:00Commented Nov 11, 2020 at 16:36