Thread: transaction bug with sequences ?

transaction bug with sequences ?

From
xoror@infuse.org
Date:
hi,

i've encountered some strange problem with ODBC  psqlodbc-07_01_0009
(system: pgsql 7.2 - cygwin)

this piece of SQL is giving me problems.


BEGIN TRANSACTION;
select nextval('some_id_seq');
ROLLBACK;
BEGIN TRANSACTION;
select nextval('some_id_seq');
ROLLBACK;
BEGIN TRANSACTION;
select nextval('some_id_seq');
ROLLBACK;
BEGIN TRANSACTION;
select nextval('some_id_seq');
ROLLBACK;

the expected result (and the result i'm getting from psql commandline
tool) is 4 times an __identical__ result value. Now, if i use ODBC and
execute these series of queries, i get 4 __different__ values. i think
something's wrong with odbc or borland bde (wich i'm using). Hope someone
could clear this one up.


thnx in advance


Re: transaction bug with sequences ?

From
xoror@infuse.org
Date:
damn, the sequence in transactions is now also giving me problems in
pgsql. so this might be a pgsql bug (?) afterall ? or dit i miss something
here...

BEGIN TRANSACTION;
select nextval('some_id_seq');
ROLLBACK;

BEGIN TRANSACTION;
select nextval('some_id_seq');
ROLLBACK;

BEGIN TRANSACTION;
select nextval('some_id_seq');
ROLLBACK;

BEGIN TRANSACTION;
select nextval('some_id_seq');
ROLLBACK;


the sequence value is incremented, but this shouldn't be the case because
i cancelled the transaction.


Re: transaction bug with sequences ?

From
Tom Lane
Date:
xoror@infuse.org writes:
> the sequence value is incremented, but this shouldn't be the case because
> i cancelled the transaction.

This is not a bug.  Sequence updates don't roll back.

            regards, tom lane

Re: transaction bug with sequences ?

From
xoror@infuse.org
Date:
On Thu, 14 Mar 2002, Tom Lane wrote:

> xoror@infuse.org writes:
> > the sequence value is incremented, but this shouldn't be the case because
> > i cancelled the transaction.
>
> This is not a bug.  Sequence updates don't roll back.
>
>             regards, tom lane
>
>

yes, i've finnally found some documentation on it.
thnx anyway :)