pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Burr, Colin <CBurr@herald.com>
Cc: 'pgsql-sql@postgresql.org' <pgsql-sql@postgresql.org>
Subject: Re: Bug: Sequence generator insert
Date: Fri, 28 Nov 2003 15:38:28 -0600
Message-ID: <20031128213828.GA24904@wolff.to> (raw)
In-Reply-To: <7D8D2AE3E5A9DB4C8D78DE0F950ABB510BDC3F56@miaxch01.herald.com>
References: <7D8D2AE3E5A9DB4C8D78DE0F950ABB510BDC3F56@miaxch01.herald.com>

On Tue, Nov 25, 2003 at 18:37:41 -0500,
  "Burr, Colin" <CBurr@herald.com> wrote:
> 
> However, even though the new record failed to be inserted into the table,
> the sequence generator was still updated.
> 
> The sequence generator should only be updated if the record is successfully
> inserted into the table, and should not be updated if the insert fails.

That isn't how sequences work. If you need a sequence of numbers without
gaps then you need to use something else. Note that the something else
will need to have a way to let only one transaction at a time update
the counter which may be a performance problem.



view thread (4+ messages)  latest in thread

Message-ID: <20031128213828.GA24904@wolff.to>
Permalink:  ../20031128213828.GA24904@wolff.to/
Also on:    postgresql.org/message-id/20031128213828.GA24904@wolff.to

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bruno@wolff.to, CBurr@herald.com
  Subject: Re: Bug: Sequence generator insert
  In-Reply-To: <20031128213828.GA24904@wolff.to>

* 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