On Tue, May 06, 2003 at 01:09:13PM +0200, Bjorn T Johansen wrote:
> Using Postgres' own serial type or handling the sequences manually?
Use the SERIAL type. Just create a column with that type and omit it on
INSERT statements -- that way, the default value will be assumed, which
is the next value for the sequence. You can't have trouble this way.
Note that you can also specify a value for the column in an INSERT (or
UPDATE) statement, and in that case the sequence won't be modified,
which can be a problem later when the sequence hits that value. You can
also set the column to a number lower than the current value of the
sequence, of course.
--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
Dios hizo a Adán, pero fue Eva quien lo hizo hombre.