Re: problems with currval and rollback - Mailing list pgsql-general

From Edward Macnaghten
Subject Re: problems with currval and rollback
Date
Msg-id 43AB478A.1090702@edlsystems.com
Whole thread Raw
In response to problems with currval and rollback  (Assad Jarrahian <jarraa@gmail.com>)
List 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
>
>


pgsql-general by date:

Previous
From: Pandurangan R S
Date:
Subject: Re: problems with currval and rollback
Next
From: Marko Kreen
Date:
Subject: Re: Why is create function bringing down the Backend server?