Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 2F3D01F3FD76 for ; Tue, 15 Nov 2011 12:12:39 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 07107-05 for ; Tue, 15 Nov 2011 16:12:33 +0000 (UTC) X-Greylist: delayed 00:05:43.392959 by SQLgrey-1.8.0-rc2 Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 692721F3FD77 for ; Tue, 15 Nov 2011 12:12:33 -0400 (AST) Received: from [76.14.161.106] (helo=newserver.jfcomputer.com) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RQLX5-0007k2-P6 for pgsql-sql@postgresql.org; Tue, 15 Nov 2011 16:06:49 +0000 Received: from localhost (unknown [127.0.0.1]) by newserver.jfcomputer.com (Postfix) with ESMTP id 74AB35759 for ; Tue, 15 Nov 2011 16:06:32 +0000 (UTC) X-Virus-Scanned: amavisd-new at site Received: from newserver.jfcomputer.com ([127.0.0.1]) by localhost (linux-jfp8.site [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ngba7cvHKrIn for ; Tue, 15 Nov 2011 08:06:31 -0800 (PST) Received: from linux-desktop.localnet (unknown [192.168.1.143]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: johnf@jfcomputer.com) by newserver.jfcomputer.com (Postfix) with ESMTPSA id BC44A5735 for ; Tue, 15 Nov 2011 08:06:31 -0800 (PST) From: John Fabiani Organization: J.F. Computer Solutions To: "pgsql-sql@postgresql.org" Subject: updating a sequence Date: Tue, 15 Nov 2011 08:06:30 -0800 User-Agent: KMail/1.13.5 (Linux/2.6.34.10-0.2-desktop; KDE/4.4.4; i686; ; ) MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <201111150806.30911.johnf@jfcomputer.com> X-Host-Lookup-Failed: Reverse DNS lookup failed for 76.14.161.106 (failed) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201111/60 X-Sequence-Number: 36033 Hi, I have need of a statement that updates the sequence but uses a max() to find the number. alter sequence somename restart with (select max(pk) from sometable). I need this for automating an ETL (using pentaho). Postgres 8.4 Thanks in advance, Johnf