Re: Double sequence increase on single insert with RULE on targeted table - Mailing list pgsql-bugs

From tomas@tuxteam.de (Tomas Zerolo)
Subject Re: Double sequence increase on single insert with RULE on targeted table
Date
Msg-id 20051116052940.GA6265@www.trapp.net
Whole thread Raw
In response to Double sequence increase on single insert with RULE on targeted table  (Sarunas Krisciukaitis <sarunask@lonus-tech.com>)
Responses Re: Double sequence increase on single insert with RULE on targeted table  (Michael Fuhr <mike@fuhr.org>)
List pgsql-bugs
On Tue, Nov 15, 2005 at 11:39:37AM +0200, Sarunas Krisciukaitis wrote:
> Dear All,
>=20
> A program produces the wrong output for any given input.
> Here comes bug report:
> 1. Database dump is attached.
> 2. Input: "BEGIN; INSERT INTO test1(some_text) VALUES ('test1'); SELECT=
=20
> lastval() as id; END;"
> 3. Output:
> INSERT 0 1
> id
> ----
>  3
> (1 row)
> 4. Exspected Output:
> id
> ----
>  2
> (1 row)
[snip]

AFAIK, serials are not guaranteed to produce sequential values; tehy
will produce unique values. That means that they can (and sometimes
will) jump.

Think about it: how could a database achieve that when the rollback of
an ongoing transaction is always possible?

Regards
-- tomas

pgsql-bugs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: BUG #2043: Documentation is incorrect...
Next
From: Michael Fuhr
Date:
Subject: Re: Double sequence increase on single insert with RULE on targeted table