Re: Getting information about sequences

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Getting information about sequences
Дата
Msg-id 20060515141351.GB21506@svana.org
обсуждение исходный текст
Ответ на Getting information about sequences  ("Forums @ Existanze" <forums@existanze.com>)
Ответы Re: Getting information about sequences  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On Mon, May 15, 2006 at 03:55:49PM +0300, Forums @ Existanze wrote:
> Hello all,
>
> I would like to ask if anyone can explain or point me to some sort of query
> that would get the sequences for a database along with the current value
> they contain.
>
> I have been able to get the sequence names, but I can get their values all
> in one query. From the documentation I can't use currval() because it needs
> setval() to precede it in the same session.

Select sequence.last_value;

It's not guarenteed to give a value that unique across users, that's
what currval/nextval are for. For if you just want an idea of where
it's up to, this will do.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Postmaster cannot start
Следующее
От: Kenneth Downs
Дата:
Сообщение: Re: GUI Interface