Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id F15529FB220 for ; Mon, 2 Oct 2006 13:49:16 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 27855-06 for ; Mon, 2 Oct 2006 13:49:12 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from main2.mycybernet.net (main2.mycybernet.net [209.222.63.140]) by postgresql.org (Postfix) with ESMTP id 5DF7C9FB21F for ; Mon, 2 Oct 2006 13:49:12 -0300 (ADT) Received: from 227-54-222-209.mycybernet.net ([209.222.54.227] helo=phlogiston.dydns.org) by main2.mycybernet.net with esmtp (Exim 4.62) (envelope-from ) id 1GURGU-0001Nb-HL for pgsql-sql@postgresql.org; Mon, 02 Oct 2006 13:07:38 -0400 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id 09A1A3FAF; Mon, 2 Oct 2006 12:49:06 -0400 (EDT) Date: Mon, 2 Oct 2006 12:49:06 -0400 From: Andrew Sullivan To: pgsql-sql@postgresql.org Subject: Re: SEQUENCES Message-ID: <20061002164905.GE32410@phlogiston.dyndns.org> References: <001801c6e641$6093f5d0$4700a8c0@TREEZANTHUS> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <001801c6e641$6093f5d0$4700a8c0@TREEZANTHUS> User-Agent: Mutt/1.5.9i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.2 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200610/5 X-Sequence-Number: 26394 On Mon, Oct 02, 2006 at 01:39:38PM -0300, Rodrigo Sakai wrote: > > I need to get all sequences and their respective current values! Is there > any catalog table or any other away to get this??? Here's a quick way to do it in a shell script, although it'd be sort of inefficient: for name in `psql -c "select relname from pg_class where relkind = 'S'" dbname; do psql -c "select last_value from $name" dbname; done. A -- Andrew Sullivan | ajs@crankycanuck.ca Unfortunately reformatting the Internet is a little more painful than reformatting your hard drive when it gets out of whack. --Scott Morris