Re: sequence advances on failed insert - Mailing list pgsql-general

From David Fetter
Subject Re: sequence advances on failed insert
Date
Msg-id 20050408001642.GA6193@fetter.org
Whole thread Raw
In response to sequence advances on failed insert  (Matthew Terenzio <matt@jobsforge.com>)
Responses Re: sequence advances on failed insert
List pgsql-general
On Thu, Apr 07, 2005 at 07:59:52PM -0400, Matthew Terenzio wrote:
> I'm noticing that a sequence is advancing even if the insertion
> fails.  Is this weird or expected?

It's expected.  Sequences are guaranteed to generate unique IDs.
These happen to be an increasing sequence of integers, but there is no
attempt to make this a gap-free sequence, and your apps should not
depend on the actual value of said ID.

HTH :)

Cheers,
D
--
David Fetter david@fetter.org http://fetter.org/
phone: +1 510 893 6100   mobile: +1 415 235 3778

Remember to vote!

pgsql-general by date:

Previous
From: Matthew Terenzio
Date:
Subject: sequence advances on failed insert
Next
From: Chris Smith
Date:
Subject: Re: using limit with delete