Re: Double sequence increase on single insert with RULE on targeted table

From: tomas(at)tuxteam(dot)de (Tomas Zerolo)
To: Sarunas Krisciukaitis <sarunask(at)lonus-tech(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Double sequence increase on single insert with RULE on targeted table
Date: 2005-11-16 05:29:40
Message-ID: 20051116052940.GA6265@www.trapp.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Nov 15, 2005 at 11:39:37AM +0200, Sarunas Krisciukaitis wrote:
> Dear All,
>
> 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
> 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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Fuhr 2005-11-16 05:51:10 Re: Double sequence increase on single insert with RULE on targeted table
Previous Message Bruce Momjian 2005-11-16 03:58:50 Re: BUG #2043: Documentation is incorrect...