From: Herouth Maoz <herouth@oumail.openu.ac.il>
To: Frederic De Leersnijder <frederic.de.leersnijder@pandora.be>
To: pgsql-sql@hub.org <pgsql-sql@hub.org>
Subject: Re: [SQL] Can I prevent my sequence to increment if an insert is rejected?
Date: Wed, 21 Jul 1999 12:15:49 +0300
Message-ID: <l03130300b3bb3fa2d669@[147.233.159.109]> (raw)
In-Reply-To: <3794A9B3.C323DC4A@pandora.be>
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.
Herouth
--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: herouth@oumail.openu.ac.il, frederic.de.leersnijder@pandora.be, pgsql-sql@hub.org
Subject: Re: [SQL] Can I prevent my sequence to increment if an insert is rejected?
In-Reply-To: <l03130300b3bb3fa2d669@[147.233.159.109]>
References: <3794A9B3.C323DC4A@pandora.be> <l03130300b3bb3fa2d669@[147.233.159.109]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox