Re: going crazy with serial type

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: going crazy with serial type
Дата
Msg-id 20020131124743.G16906-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на Re: going crazy with serial type  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On Thu, 31 Jan 2002, Tom Lane wrote:

> Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
> > You won't get that.  serial (and sequences) are guaranteed to give numbers
> > that haven't shown up in the sequence (note: you can still get duplicates
> > if you set values yourself, you can get around this with triggers -
>
> The SERIAL type implicitly adds a UNIQUE index, so you don't need to
> worry about uniqueness even if you sometimes manually insert values.

Right, but you get the intermittent errors in that case since the serial
doesn't skip the values that would error (which you might expect if you're
guaranteeing distinct numbers in a column).  When looked at as what it is
(an integer with a default) it makes sense, but if you don't know that
it's a bit unexpected.



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

Предыдущее
От: Jason Earl
Дата:
Сообщение: Re: going crazy with serial type
Следующее
От: "Gregory Wood"
Дата:
Сообщение: Re: going crazy with serial type