Re: [SQL] Can I prevent my sequence to increment if an insert isrejected?

From: Chris Bitmead <chris(at)tech(dot)com(dot)au>
To: Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il>
Cc: Frederic De Leersnijder <frederic(dot)de(dot)leersnijder(at)pandora(dot)be>, "pgsql-sql(at)hub(dot)org" <pgsql-sql(at)hub(dot)org>
Subject: Re: [SQL] Can I prevent my sequence to increment if an insert isrejected?
Date: 1999-07-21 09:36:59
Message-ID: 379594BB.1496E4FB@tech.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Herouth Maoz wrote:
>
> At 19:54 +0300 on 20/07/1999, Frederic De Leersnijder wrote:
>
> > Hi,
> >
> > when I try to insert a record and it curses with fields with a unique
> > key on them my sequence I use for my primary key does increment. How can
> > I prevent this from happening?
>
> You can't. The point of sequences is that they ensure you of unique values,
> but they DO NOT ensure you of gap-free values. This allows sequences to be
> used momentarily, without being locked for the duration of a transaction,
> thus allowing many users to get values with minimal contention.

I missed the original question, but don't you get sequential numbers as
long as cache is 0?

--
Chris Bitmead
mailto:chris(at)tech(dot)com(dot)au
http://www.techphoto.org - Photography News, Stuff that Matters

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Herouth Maoz 1999-07-21 09:45:16 Re: [SQL] Can I prevent my sequence to increment if an insert isrejected?
Previous Message Herouth Maoz 1999-07-21 09:15:49 Re: [SQL] Can I prevent my sequence to increment if an insert is rejected?