Re: sequenc_name.currval not defined

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: MT <mt(at)open2web(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: sequenc_name.currval not defined
Date: 2002-11-21 23:07:20
Message-ID: Pine.LNX.4.33.0211211606350.24006-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Philip Hallstrom 2002-11-21 23:07:35 Re: sequenc_name.currval not defined
Previous Message Andy Kriger 2002-11-21 23:07:06 how do i find out when a record was created/modified?