Re: [HACKERS] Sequences.... - Mailing list pgsql-hackers

From D'Arcy" "J.M." Cain
Subject Re: [HACKERS] Sequences....
Date
Msg-id m10Nq7f-0000cCC@druid.net
Whole thread Raw
In response to Re: [HACKERS] Sequences....  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] Sequences....
List 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 by date:

Previous
From: Clark Evans
Date:
Subject: Re: [HACKERS] Removing derived files from CVS
Next
From: Bruce Momjian
Date:
Subject: 6.5 Features list