Re: Cannot insert a duplicate key into unique index
От
daq
Тема
Re: Cannot insert a duplicate key into unique index
Дата
Msg-id
17675789710.20040219080104@ugyvitelszolgaltato.hu
Ответ на
Список
Дерево обсуждения
Cannot insert a duplicate key into unique index <kynn@panix.com>
Re: Cannot insert a duplicate key into unique index Tom Lane <tgl@sss.pgh.pa.us>
Re: Cannot insert a duplicate key into unique index daq <daq@ugyvitelszolgaltato.hu>
Re: Cannot insert a duplicate key into unique index <kynn@panix.com>
Re: Cannot insert a duplicate key into unique index daq <daq@ugyvitelszolgaltato.hu>
Re: Cannot insert a duplicate key into unique index Terry Lee Tucker <terry@esc1.com>
Re: Cannot insert a duplicate key into unique index <kynn@panix.com>
Re: Cannot insert a duplicate key into unique index joseph speigle <joe.speigle@jklh.us>
Re: Cannot insert a duplicate key into unique index Noel <noel.faux@med.monash.edu.au>
Re: Cannot insert a duplicate key into unique index joseph speigle <joe.speigle@jklh.us>
>> The insert statement that is producing this error does not
>> include a value for the pkey field in question (this field is of type
>> SERIAL). I imagine that somehow the counter associated with this
>> field got messed up, so that it is mistakenly generating a value that
>> has been used already. How can I straighten it out?
TL> You need to do something like
TL> select setval('seq-name', (select max(col) + 1 from table));
TL> regards, tom lane
The setval function updates the last_value field of the sequence table. You don't need the "+ 1".
select setval('seq-name', (select max(col) from table));
DAQ
В списке pgsql-novice по дате отправления