Re: serial increments on failed insert

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: serial increments on failed insert
Дата
Msg-id 27882.1105753361@sss.pgh.pa.us
обсуждение исходный текст
Ответ на serial increments on failed insert  (David Kammer <djkammer@u.washington.edu>)
Список pgsql-general
David Kammer <djkammer@u.washington.edu> writes:
> Notice that even though the second insert failed, it still incremented
> the serial value.  This seems counter intuative to the way that serial
> should work.  Is this truly a bug,

No.  nextval() calls never roll back; see the documentation.

> is there a good work around?

Don't assume that a serial column is without gaps.  It's only intended
to be unique.

            regards, tom lane

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

Предыдущее
От: David Kammer
Дата:
Сообщение: serial increments on failed insert
Следующее
От: Steve Atkins
Дата:
Сообщение: Re: serial increments on failed insert