Re: sequences vs. transactions - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: sequences vs. transactions
Date
Msg-id 199905120205.WAA01843@candle.pha.pa.us
Whole thread Raw
In response to sequences vs. transactions  (Vazsonyi Peter <neko@sp1.szif.hu>)
Responses Re: [HACKERS] Re: sequences vs. transactions
List 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@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: [HACKERS] 6.5 TODO list
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] 6.5 TODO list