Re: using sequences

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Erik Price <eprice(at)ptc(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: using sequences
Date: 2003-06-13 21:08:36
Message-ID: 20030613210836.GB20982@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Jun 13, 2003 at 16:26:47 -0400,
Erik Price <eprice(at)ptc(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message scott.marlowe 2003-06-13 21:10:28 Re: How to change column type in PostgreSQL 7.1.2
Previous Message The Hermit Hacker 2003-06-13 21:06:10 Re: [HACKERS] SAP and MySQL ... [and Benchmark]