Re: [HACKERS] Sequences....

Поиск
Список
Период
Сортировка
От D'Arcy" "J.M." Cain
Тема Re: [HACKERS] Sequences....
Дата
Msg-id m10Nq7f-0000cCC@druid.net
обсуждение исходный текст
Ответ на Re: [HACKERS] Sequences....  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [HACKERS] Sequences....  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Thus spake Tom Lane
> "D'Arcy" "J.M." Cain <darcy@druid.net> writes:
> > Alternatively, maybe we can enforce the serialism of the type.  Even
> > if the user specifies a value, ignore it and put the next number in
> > anyway.
> 
> I don't like that at *all*.

I'm not entirely crazy about it myself.  I included it as an option because
it seemed to follow from the definition of serial number.  However, in
practice I imagine that people would find it overly restrictive.

> > Do as above but allow the user to specify a number as long as it is
> > available and is lower than the next number in the series.
> 
> I think better would be that the sequence value is silently forced to
> be at least as large as the inserted number, whenever a specific number
> is inserted into a SERIAL field.  That would ensure we never generate
> duplicates, but not require keeping any extra state.

I see your point but that could cause problems if you start your sequence
too high.  I guess the answer to that is, "Don't do that."

Hmm.  Are you suggesting that if I insert a number higher than the next
sequence that the intervening numbers are never available?

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 424 2871     (DoD#0082)    (eNTP)   |  what's for dinner.


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

Предыдущее
От: Clark Evans
Дата:
Сообщение: Re: [HACKERS] Removing derived files from CVS
Следующее
От: Bruce Momjian
Дата:
Сообщение: 6.5 Features list