Re: SERIAL datatype

From: Sam Mason <sam(at)samason(dot)me(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: SERIAL datatype
Date: 2008-08-22 14:38:02
Message-ID: 20080822143802.GA7271@frubble.xen.chris-lamb.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Aug 21, 2008 at 09:08:24PM +0200, Peter Billen wrote:
> Is it possible to insert a new entry? Will the serial sequence somehow
> be able to find the gap (3)?

As others have said, no it's not going to. Sequences will only return
values out of order when explicitly told to. The main reason is to
help prevent ambiguities in the data; if it could automatically reset
it would be much more difficult to determine if 7 was "older" than 3
or, worse, which 7 is the correct one. In a well designed system this
shouldn't ever occur, but if something does go horribly wrong it's much
easier to put the pieces back together this way.

Sam

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2008-08-22 15:37:35 Re: Postgresql 8.3 statistic stadistinct value dead wrong even with default_statistics_target=1000
Previous Message Markus Mehrwald 2008-08-22 13:48:43 Re: problem with foreign keys + data-only backup