Re: sequenc_name.currval not defined - Mailing list pgsql-general

From scott.marlowe
Subject Re: sequenc_name.currval not defined
Date
Msg-id Pine.LNX.4.33.0211211606350.24006-100000@css120.ihs.com
Whole thread Raw
In response to sequenc_name.currval not defined  (MT <mt@open2web.com>)
List pgsql-general
On Thu, 21 Nov 2002, MT wrote:

> Hi,
>
> I keep on getting the following error when I attempt to insert a new record:
>
> SELECT * FROM table_name WHERE tableid = currval('tableid_seq');
>
> PostgreSQL said: ERROR: tableid_seq.currval is not yet defined in this
> session.
>
> What's weird about this problem is that I have a script that
> successfully performs this action.

currval only works during a session when nextval or setval have been run.
It's how it's supposed to work.  It's part of the magic of making
sequences transaction safe.


pgsql-general by date:

Previous
From: Philip Hallstrom
Date:
Subject: Re: sequenc_name.currval not defined
Next
From: Doug McNaught
Date:
Subject: Re: how do i find out when a record was created/modified?