Re: getting currval from a sequence - BUG ? - Mailing list pgsql-general

From Doug McNaught
Subject Re: getting currval from a sequence - BUG ?
Date
Msg-id m3it94x726.fsf@varsoon.denali.to
Whole thread Raw
In response to getting currval from a sequence  (tony <tony@animaproductions.com>)
List pgsql-general
Jan Poslusny <pajout@gingerall.cz> writes:

> Hi,
> select currval('sequence_name');
> with quotes should help you. But my pg 7.1.2 throws error
> "sequence_name.currval is not yet defined in this session" (possibly
> bug ?). If I use sequence before calling this (for instance "insert
> into mytable values(nextval('sequence_name'));" ), all is OK.

This is documented behavior.  See the FAQ and the docs.

-Doug
--
Let us cross over the river, and rest under the shade of the trees.
   --T. J. Jackson, 1863

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: initdb - segmentation fault
Next
From: jtp
Date:
Subject: compiling on sco