Re: using sequences - Mailing list pgsql-general

From Bruno Wolff III
Subject Re: using sequences
Date
Msg-id 20030613210836.GB20982@wolff.to
Whole thread Raw
In response to using sequences  (Erik Price <eprice@ptc.com>)
Responses Re: using sequences  (Erik Price <eprice@ptc.com>)
List pgsql-general
On Fri, Jun 13, 2003 at 16:26:47 -0400,
  Erik Price <eprice@ptc.com> wrote:
> I have read the manual about sequences and I thought I understood both
> their purpose and how to use them.  When I perform inserts, the sequence
> is updated appropriately.  However, I can't seem to directly access the
> sequence myself.  I always seem to get this message:
>
> be_db=# select currval('news_news_id_seq');
> ERROR:  news_news_id_seq.currval is not yet defined in this session
>
> Can someone explain what is going on?

If you are trying to do this you probably don't really understand sequences.
There aren't any common good reasons for trying to get the value of a sequence
before you have generated a value in the current session.

pgsql-general by date:

Previous
From: "Maksim Likharev"
Date:
Subject: Re: return records in DB load order??
Next
From: The Hermit Hacker
Date:
Subject: Re: [HACKERS] SAP and MySQL ... [and Benchmark]