Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rcuqo-002rdU-G3 for pgsql-sql@arkaria.postgresql.org; Wed, 21 Feb 2024 22:14:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rcuqm-006qeY-G9 for pgsql-sql@arkaria.postgresql.org; Wed, 21 Feb 2024 22:14:00 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rcuqm-006qeO-6U for pgsql-sql@lists.postgresql.org; Wed, 21 Feb 2024 22:14:00 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rcuqj-000KeY-3c for pgsql-sql@lists.postgresql.org; Wed, 21 Feb 2024 22:13:59 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 41LMDuMJ174179; Wed, 21 Feb 2024 17:13:56 -0500 From: Tom Lane To: "Campbell, Lance" cc: "pgsql-sql@lists.postgresql.org" Subject: Re: How to find all current sequence IDs In-reply-to: References: Comments: In-reply-to "Campbell, Lance" message dated "Wed, 21 Feb 2024 22:06:55 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <174177.1708553636.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 21 Feb 2024 17:13:56 -0500 Message-ID: <174178.1708553636@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "Campbell, Lance" 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 =3D 'S'; regards, tom lane