Re: SERIAL error

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: SERIAL error
Дата
Msg-id 20041128051041.GA34185@winnie.fuhr.org
обсуждение исходный текст
Ответ на SERIAL error  (mstory@uchicago.edu)
Ответы Re: SERIAL error  (mstory@uchicago.edu)
Список pgsql-general
On Sat, Nov 27, 2004 at 10:45:54PM -0600, mstory@uchicago.edu wrote:
>
> I'm using v. 7.4.2, and am encountering a problem with serial types.  On an
> insert into a table that results in failure for any number of reasone (mostly
> violation of contraints) I've found that the Sequence for the column of type
> serial will still bump the value up once.

This behavior is intentional.  See the PostgreSQL documentation and
the FAQ:

http://www.postgresql.org/docs/7.4/static/functions-sequence.html
http://www.postgresql.org/docs/faqs/FAQ.html#4.15.4

> Anyway, was wondering if this needed to be reported as a bug?  Seems
> to cause problems for certain generic uses for the serial type.

What do you mean by "generic uses"?  Sequences are for obtaining
unique values; problems caused by assuming anything else are almost
certainly application bugs.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

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

Предыдущее
От: Mike Mascari
Дата:
Сообщение: Re: SERIAL error
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: SERIAL error