Re: BUG #13507: INSERT into tables with SERIAL primary keys failing about half of the time

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #13507: INSERT into tables with SERIAL primary keys failing about half of the time
Дата
Msg-id 28061.1437486045@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #13507: INSERT into tables with SERIAL primary keys failing about half of the time  (John R Pierce <pierce@hogranch.com>)
Список pgsql-bugs
John R Pierce <pierce@hogranch.com> writes:
> On 7/20/2015 5:39 PM, dsrich@dsrich.net wrote:
>> This query (and three other versions  using DEFAULT and 'RETURNING payeenum'
>> clauses) fails about half the time with payees_pkey constraint violation.

> when you create a column of pseudotype SERIAL, it creates a SEQUENCE.

Yeah.  Have you checked whether the last_value of the sequence is above
the maximum value in the payeenum column?  It's not terribly hard to get
that out-of-sync, unfortunately, typically by loading data with
predetermined serial values.

The sequence is probably named payees_payeenum_seq, but psql's \d on
the payees table would show you for sure.

            regards, tom lane

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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: [HACKERS] object_classes array is broken, again
Следующее
От: Fabien COELHO
Дата:
Сообщение: Re: BUG #13442: ISBN doesn't always roundtrip with text