Re: problems with currval and rollback

From: Edward Macnaghten <eddy(at)edlsystems(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: problems with currval and rollback
Date: 2005-12-23 00:40:42
Message-ID: 43AB478A.1090702@edlsystems.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Without seeing the SQL statements you executed in the session it is
difficult to see your problem.

Getting a current sequence after a rollback is no problem (in 8.0
anyway). Please note though, the sequence itself is NOT rolled back.
This is correct behaviour. Currval will return the last sequence
retrieved for the session (using nextval), even if other sessions have
accessed the sequence in the intervening time.

Eddy

Assad Jarrahian wrote:

>Hi all,
> So I started to make some changes with my code here and there
>(nothing to do with the relevant lines) and suddenly currval and
>rollback don't work.
>
>
>
>
<snip content="code"/>

>What happens is that the it inserts a db, but cannot get a value back
>using currval (ERROR: ERROR: currval of sequence "lm_id_seq" is not
>yet defined in this session 55000 ) , yet the db gets the addlm
>inserted.
>
>
>Shouldn't it rollback?
>Furthermore, why would currval suddenly stop working?
>
>Much thanks for your feedback in advance.
>
>-assad
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message littlebutty 2005-12-23 01:04:30 bit/integer operations in postgres
Previous Message Bruce Momjian 2005-12-23 00:40:17 Re: is this a bug or I am blind?