Re: duplicate key violates unique constraint

Поиск
Список
Период
Сортировка
От vtaquette@globo.com
Тема Re: duplicate key violates unique constraint
Дата
Msg-id 450D86C3000078BD@mail03.sc2.he.tucows.com
обсуждение исходный текст
Ответ на duplicate key violates unique constraint  (vtaquette@globo.com)
Список pgsql-general
Hey, I've just find out what's happening.
The problem is the "serial" datatype creates a sequence in the background
(project_id_seq). If the sequence current numeber is 1, and I manually insert
a new entry whit ID=2, the sequence doesn't "know" it. So when I try the
INSERT statement, the next value in sequence is 2, and I get the error.
The thing is, I'm migrating my system from mysql to postgresql, and that's
why I was inserting directely the numbers (importing the .sql file), without
respecting the backgroud sequence.

Thanks a lot for those who answered me.
Regards,
Verônica



В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Initializing Datums for use with SPI_execute_plan
Следующее
От: Eci Souji
Дата:
Сообщение: statistics buffer is full on heavily loaded 8.1.4 db.