Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 855C9A5A444 for ; Tue, 15 Nov 2011 20:28:57 -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 97135-10 for ; Wed, 16 Nov 2011 00:28:48 +0000 (UTC) X-Greylist: from auto-whitelisted 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 294CEA5A442 for ; Tue, 15 Nov 2011 20:28:47 -0400 (AST) Received: from [76.14.161.106] (helo=newserver.jfcomputer.com) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RQTMp-00016z-3I for pgsql-sql@postgresql.org; Wed, 16 Nov 2011 00:28:47 +0000 Received: from localhost (unknown [127.0.0.1]) by newserver.jfcomputer.com (Postfix) with ESMTP id 305205759; Wed, 16 Nov 2011 00:28:29 +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 YXmGLK4I4La0; Tue, 15 Nov 2011 16:28:24 -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 15A314E06; Tue, 15 Nov 2011 16:28:24 -0800 (PST) From: John Fabiani Organization: J.F. Computer Solutions To: pgsql-sql@postgresql.org Subject: Re: updating a sequence Date: Tue, 15 Nov 2011 16:28:23 -0800 User-Agent: KMail/1.13.5 (Linux/2.6.34.10-0.2-desktop; KDE/4.4.4; i686; ; ) Cc: Richard Broersma References: <201111150806.30911.johnf@jfcomputer.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201111151628.23731.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/63 X-Sequence-Number: 36036 On Tuesday, November 15, 2011 08:33:54 am Richard Broersma wrote: > On Tue, Nov 15, 2011 at 8:06 AM, John Fabiani wrote: > > alter sequence somename restart with (select max(pk) from sometable). > > > > I need this for automating an ETL (using pentaho). > > http://www.postgresql.org/docs/9.1/interactive/functions-sequence.html#FUNC > TIONS-SEQUENCE-TABLE I don't see how that helps answer my problem. I know how to update a sequence. I want to pass a value for the restart vaue that depends on a query - all in one statement. I would think it is a common problem i.e. migrating data. Thanks, Johnf