Re: How to find all current sequence IDs

Поиск
Список
Период
Сортировка
От Nisarg Patel
Тема Re: How to find all current sequence IDs
Дата
Msg-id CAA=RfSPoPw0ERRGEQTVGYvAzJjES42At0bhxCNvW1x_LnAu0nw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: How to find all current sequence IDs  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы RE: How to find all current sequence IDs  ("Campbell, Lance" <lance@illinois.edu>)
Список pgsql-sql
This has worked for me in the past:
select schemaname, sequencename, last_value
from pg_sequences;

Thank you,
Nisarg

On Wed, Feb 21, 2024, 5:14 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
"Campbell, Lance" <lance@illinois.edu> writes:
> Is there a way to get a list of all sequences, the schema it is used in, and the current sequence number in use?

Try something like

select relname, relnamespace::regnamespace, pg_sequence_last_value(oid)
from pg_class where relkind = 'S';

                        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: How to find all current sequence IDs
Следующее
От: Cars Jeeva
Дата:
Сообщение: PG_DUMP ERROR