Z
Z
zkweb2015-09-23 17:48:19
PostgreSQL
zkweb, 2015-09-23 17:48:19

How to fix an error when adding a record after importing to the database?

Made import in the table. Imported more than 10 thousand records
Now, when inserting a new record into the table, an error occurs:
postgresql duplicate key value violates unique constraint
i.e. it does not create a new index chtoli ....
through PhpPgAdmin updated the index (rebuild the index) also does not help if the table is cleared that records are normally added.
Help me please

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Shelemetiev, 2015-09-23
@zoroda

You are trying to insert a record that already exists in the table. The problem is not in the index, but in the restriction on the uniqueness of the record. Check the unique constraint on your table.

J
jsse, 2015-09-23
@jsse

Problem with sequence, dig in this direction

K
krypt3r, 2015-09-24
@krypt3r

ALTER SEQUENCE имя RESTART WITH значение_перезапуска;

You can view the current values ​​in sequence using SELECT

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question