pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chris Bitmead <chris@tech.com.au>
To: Herouth Maoz <herouth@oumail.openu.ac.il>
Cc: Frederic De Leersnijder <frederic.de.leersnijder@pandora.be>
Cc: pgsql-sql@hub.org <pgsql-sql@hub.org>
Subject: Re: [SQL] Can I prevent my sequence to increment if an insert isrejected?
Date: Wed, 21 Jul 1999 19:36:59 +1000
Message-ID: <379594BB.1496E4FB@tech.com.au> (raw)
References: <l03130300b3bb3fa2d669@[147.233.159.109]>

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



view thread (5+ messages)  latest in thread

Message-ID: <379594BB.1496E4FB@tech.com.au>
Permalink:  ../379594BB.1496E4FB@tech.com.au/
Also on:    postgresql.org/message-id/379594BB.1496E4FB@tech.com.au

 · 

reply

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: chris@tech.com.au, 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 isrejected?
  In-Reply-To: <379594BB.1496E4FB@tech.com.au>
  References: <l03130300b3bb3fa2d669@[147.233.159.109]> <379594BB.1496E4FB@tech.com.au>

* 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