Answer the question
In order to leave comments, you need to log in
Why does constraint for relation already exists error occur when importing a postgres database?
Good afternoon,
Such a problem.
There is a working site named domain1 . I do export in pgAdmin ||| . Selected:
Encoding UTF-8 , Owner - postgres, Checked DROP , INSERT .
Got a backup. If I import it on another machine into a database with the same name ( dbname1 ) , the import succeeds. If I merge the import into a database with a different name dbname2 , something like this happens:
psql:dump_1.sql:8266: ERROR: constraint "mc_valutes_tenant_id_fkey" for relation "mc_courses" already exists
multiple primary keys for table "f_pays" are not allowed
DETAIL: Key (id)=(631010000) already exists.
psql:dump_1.sql:7527: ERROR: duplicate key value violates unique constraint "t_places_pkey"
Import in debian:
sudo -su postgres psql dbname2
\i dump.sql
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question