Re: using sequences

Поиск
Список
Период
Сортировка
От weigelt@metux.de
Тема Re: using sequences
Дата
Msg-id 20030613203707.GA15208@metux.de
обсуждение исходный текст
Ответ на using sequences  (Erik Price <eprice@ptc.com>)
Список 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 по дате отправления:

Предыдущее
От: "scott.marlowe"
Дата:
Сообщение: Re: Pg_dumpall
Следующее
От: "Maksim Likharev"
Дата:
Сообщение: Re: return records in DB load order??