Re: sequences vs. transactions

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Vazsonyi Peter <neko(at)sp1(dot)szif(dot)hu>
Cc: PostgreSQL-development <hackers(at)postgreSQL(dot)org>
Subject: Re: sequences vs. transactions
Date: 1999-05-12 02:05:58
Message-ID: 199905120205.WAA01843@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Hi!
> I found a bug, with $SUBJ - i mean ... so look at this:
> t=> begin;
> BEGIN
> t=> select nextval('some_seq');
> nextval
> -------
> 4
> (1 row)
> t=> rollback;
> ROLLBACK
> t=> select nextval('some_seq');
> nextval
> -------
> 5 <<<< five! and NOT 4 again, but 4 expected i think
> (1 row)
>
> Or seqences are special case in transations?

Sequence numbers are not re-used like normal transactions. The reason
for this is that we would have to lock the sequence table for the entire
duration of the transaction until it was committed if we wanted to do
that.

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-05-12 02:11:22 Re: [HACKERS] 6.5 TODO list
Previous Message Tatsuo Ishii 1999-05-12 00:57:54 Re: [HACKERS] 6.5 TODO list