Received: from tech.com.au (IDENT:root@techpt.lnk.telstra.net [139.130.75.122]) by hub.org (8.9.3/8.9.3) with ESMTP id FAA31919 for ; Wed, 21 Jul 1999 05:37:56 -0400 (EDT) (envelope-from chris@tech.com.au) Received: from tech.com.au (IDENT:chris@tech [203.41.180.241]) by tech.com.au (8.9.3/8.9.3) with ESMTP id TAA01693; Wed, 21 Jul 1999 19:36:59 +1000 Sender: chris@tech.com.au Message-ID: <379594BB.1496E4FB@tech.com.au> Date: Wed, 21 Jul 1999 19:36:59 +1000 From: Chris Bitmead X-Mailer: Mozilla 4.6 [en] (X11; I; Linux 2.2.9 i686) X-Accept-Language: en MIME-Version: 1.0 To: Herouth Maoz CC: Frederic De Leersnijder , "pgsql-sql@hub.org" Subject: Re: [SQL] Can I prevent my sequence to increment if an insert isrejected? References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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@tech.com.au http://www.techphoto.org - Photography News, Stuff that Matters