Re: duplicate key violates unique constraint

Поиск
Список
Период
Сортировка
От Spiegelberg, Greg
Тема Re: duplicate key violates unique constraint
Дата
Msg-id 82E74D266CB9B44390D3CCE44A781ED90B6B1A@POSTOFFICE.cranel.local
обсуждение исходный текст
Ответ на Re: duplicate key violates unique constraint  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-admin
> From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
>
> "Spiegelberg, Greg" <gspiegelberg@isodxsolutions.com> writes:
> > As you can see, it's only providing the key1 column and the
> sequence is
> > providing the value for the column with the constraint.
> How can this be
> > happening?
>
> Perhaps at some point you manually inserted an id value past the
> then-current sequence value?

I have to assume that though I don't see it anywhere in the logs and the
logs are turned up all the way.  The database is continually being
dropped and recreated automatically.  Why this doesn't happen every time
the same data is imported or more often is leaving me scratching my
head.


> No, you've misunderstood currval().  That gives the value
> most recently
> obtained by nextval() within your own session; it is not
> affected by any
> subsequent manipulation of the sequence.

Thanks.  That does explain it.  I had incorrectly assumed currval()
always returned what the real current value of the sequence.

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

Предыдущее
От: Carol Walter
Дата:
Сообщение: Re: duplicate key violates unique constraint
Следующее
От: "Sorin N. Ciolofan"
Дата:
Сообщение: increasing of the shared memory does not solve the problem of "OUT of shared memory"