Re: getting currval from a sequence - BUG ?

From: Doug McNaught <doug(at)wireboard(dot)com>
To: Jan Poslusny <pajout(at)gingerall(dot)cz>
Cc: tony <tony(at)animaproductions(dot)com>, postgres list <pgsql-general(at)postgresql(dot)org>
Subject: Re: getting currval from a sequence - BUG ?
Date: 2002-02-11 17:27:29
Message-ID: m3it94x726.fsf@varsoon.denali.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jan Poslusny <pajout(at)gingerall(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message jtp 2002-02-11 18:13:21 compiling on sco
Previous Message Tom Lane 2002-02-11 17:18:31 Re: initdb - segmentation fault