From: | "Campbell, Lance" <lance(at)illinois(dot)edu> |
---|---|
To: | Nisarg Patel <er(dot)nisarg(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "pgsql-sql(at)lists(dot)postgresql(dot)org" <pgsql-sql(at)lists(dot)postgresql(dot)org> |
Subject: | RE: How to find all current sequence IDs |
Date: | 2024-02-29 14:49:26 |
Message-ID: | SJ0PR11MB562929E58B465C88D275156ADE5F2@SJ0PR11MB5629.namprd11.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
That worked great. Thanks so much.
From: Nisarg Patel <er(dot)nisarg(at)gmail(dot)com>
Sent: Wednesday, February 21, 2024 5:17 PM
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Campbell, Lance <lance(at)illinois(dot)edu>; pgsql-sql(at)lists(dot)postgresql(dot)org
Subject: Re: How to find all current sequence IDs
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(at)sss(dot)pgh(dot)pa(dot)us<mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us>> wrote:
"Campbell, Lance" <lance(at)illinois(dot)edu<mailto:lance(at)illinois(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | intmail01 | 2024-03-08 12:01:11 | How to know if all insertions are finished |
Previous Message | Cars Jeeva | 2024-02-22 10:42:08 | PG_DUMP ERROR |