Received: from mx99.openu.ac.il (arbel.openu.ac.il [147.233.32.4]) by hub.org (8.9.3/8.9.3) with ESMTP id FAA28358 for ; Wed, 21 Jul 1999 05:15:28 -0400 (EDT) (envelope-from herouth@oumail.openu.ac.il) Received: from talmon.openu.ac.il (talmon.openu.ac.il [147.233.32.11]) by mx99.openu.ac.il (Postfix) with ESMTP for id CD7C04B59C; Wed, 21 Jul 1999 12:15:22 +0300 (IDT) Received: from [147.233.159.109] (mac-herouth.pc.openu.ac.il) by talmon.openu.ac.il (Netscape Messaging Server 3.54) with ESMTP id AAA3B7; Wed, 21 Jul 1999 12:18:37 +0300 X-Sender: herouth@shaked.cc.openu.ac.il Message-Id: In-Reply-To: <3794A9B3.C323DC4A@pandora.be> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Wed, 21 Jul 1999 12:15:49 +0300 To: Frederic De Leersnijder , "pgsql-sql@hub.org" From: Herouth Maoz Subject: Re: [SQL] Can I prevent my sequence to increment if an insert is rejected? 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