E
E
EVOSandru62016-04-25 13:31:59
PostgreSQL
EVOSandru6, 2016-04-25 13:31:59

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

In the sql file, I checked that the names of foreign keys are not repeated.
What could be the problem?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question