public inbox for [email protected]  
help / color / mirror / Atom feed
From: Campbell, Lance <[email protected]>
To: Nisarg Patel <[email protected]>
To: Tom Lane <[email protected]>
Cc: [email protected] <[email protected]>
Subject: RE: How to find all current sequence IDs
Date: Thu, 29 Feb 2024 14:49:26 +0000
Message-ID: <SJ0PR11MB562929E58B465C88D275156ADE5F2@SJ0PR11MB5629.namprd11.prod.outlook.com> (raw)
In-Reply-To: <CAA=RfSPoPw0ERRGEQTVGYvAzJjES42At0bhxCNvW1x_LnAu0nw@mail.gmail.com>
References: <SJ0PR11MB562974ADFAF0F0CFB72A8B6DDE572@SJ0PR11MB5629.namprd11.prod.outlook.com>
	<[email protected]>
	<CAA=RfSPoPw0ERRGEQTVGYvAzJjES42At0bhxCNvW1x_LnAu0nw@mail.gmail.com>

That worked great. Thanks so much.

From: Nisarg Patel <[email protected]>
Sent: Wednesday, February 21, 2024 5:17 PM
To: Tom Lane <[email protected]>
Cc: Campbell, Lance <[email protected]>; [email protected]
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 <[email protected]<mailto:[email protected]>> wrote:
"Campbell, Lance" <[email protected]<mailto:[email protected]>> 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



view thread (4+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: RE: How to find all current sequence IDs
  In-Reply-To: <SJ0PR11MB562929E58B465C88D275156ADE5F2@SJ0PR11MB5629.namprd11.prod.outlook.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox