Re: using sequences - Mailing list pgsql-general

From weigelt@metux.de
Subject Re: using sequences
Date
Msg-id 20030613203707.GA15208@metux.de
Whole thread Raw
In response to using sequences  (Erik Price <eprice@ptc.com>)
List pgsql-general
On Fri, Jun 13, 2003 at 04:26:47PM -0400, Erik Price wrote:

<snip>
> 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 i understood it right, the sequence values are separate for each
session. so you can easily call currval() w/o having to care what
other sessions do w/ the seq. this of course requires counting up
the seq w/ nextval().

you can get the global status w/ qeuring the sequence relation directly:

SELECT news_news_id_seq.last_value;

cu
--
---------------------------------------------------------------------
 Enrico Weigelt    ==   metux ITS
 Webhosting ab 5 EUR/Monat.          UUCP, rawIP und vieles mehr.

 phone:     +49 36207 519931         www:       http://www.metux.de/
 fax:       +49 36207 519932         email:     contact@metux.de
 cellphone: +49 174 7066481         smsgate:   sms.weigelt@metux.de
---------------------------------------------------------------------
 Diese Mail wurde mit UUCP versandt.      http://www.metux.de/uucp/

pgsql-general by date:

Previous
From: "scott.marlowe"
Date:
Subject: Re: Pg_dumpall
Next
From: "Maksim Likharev"
Date:
Subject: Re: return records in DB load order??