Re: BUG #1139: Auto-increment and Rollback

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Emil Tarazi <emil(at)cmu(dot)edu>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1139: Auto-increment and Rollback
Date: 2004-04-20 00:57:47
Message-ID: 20040420005747.GA19205@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Apr 19, 2004 at 20:16:15 -0300,
PostgreSQL Bugs List <pgsql-bugs(at)postgresql(dot)org> wrote:
>
> The following bug has been logged online:
>
> Bug reference: 1139
> Logged by: Emil Tarazi
>
> Email address: emil(at)cmu(dot)edu
>
> PostgreSQL version: 7.4
>
> Operating system: Linux
>
> Description: Auto-increment and Rollback
>
> Details:
>
> If a query is called within a BEGIN-COMMIT/ROLLBACK block that
> auto-increments some field, a ROLLBACK will not decrement that field.

Assuming you are refering to sequences, that's the way it is supposed
to work.
You really should only be using sequences to get unique values.
Within a single session expecting the values to be monotonically
increasing is also valid. Other than that you shouldn't be making
any assumptions about the relation between returned values.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2004-04-20 03:46:57 Re: [BUGS] Bug in pg_autovacuum ?
Previous Message Bruce Momjian 2004-04-19 23:24:40 Re: BUG #1140: Auto-increment and Rollback