Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 8C4A92BA6B for ; Wed, 16 Nov 2011 15:33:26 -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 89199-08 for ; Wed, 16 Nov 2011 19:33:20 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id A1EB02BA6A for ; Wed, 16 Nov 2011 15:33:20 -0400 (AST) Received: from lo.gmane.org ([80.91.229.12]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RQlET-0008V1-IQ for pgsql-sql@postgresql.org; Wed, 16 Nov 2011 19:33:19 +0000 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RQlEF-0004ze-3w for pgsql-sql@postgresql.org; Wed, 16 Nov 2011 20:33:03 +0100 Received: from ip-118-90-107-76.xdsl.xnet.co.nz ([118.90.107.76]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 16 Nov 2011 20:33:03 +0100 Received: from jasen by ip-118-90-107-76.xdsl.xnet.co.nz with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 16 Nov 2011 20:33:03 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-sql@postgresql.org From: Jasen Betts Subject: Re: updating a sequence Date: 16 Nov 2011 18:49:08 GMT Organization: Dis (not Dat) Organisation Lines: 14 Message-ID: References: <201111150806.30911.johnf@jfcomputer.com> <201111151628.23731.johnf@jfcomputer.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: ip-118-90-107-76.xdsl.xnet.co.nz X-Face: ?)Aw4rXwN5u0~$nqKj`xPz>xHCwgi^q+^?Ri*+R(&uv2=E1Q0Zk(>h!~o2ID@6{uf8s; a +M[5[U[QT7xFN%^gR"=tuJw%TXXR'Fp~W; (T"1(739R%m0Yyyv*gkGoPA.$b,D.w:z+<'"=-lVT?6 {T?=R^:W5g|E2#EhjKCa+nt":4b}dU7GYB*HBxn&Td$@f%.kl^:7X8rQWd[NTc"P"u6nkisze/Q; 8 "9Z{peQF,w)7UjV$c|RO/mQW/NMgWfr5*$-Z%u46"/00mx-,\R'fLPe.)^ User-Agent: slrn/pre1.0.0-18 (Linux) 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/71 X-Sequence-Number: 36044 On 2011-11-16, Scott Marlowe wrote: > You need to wrap a subselect in (): > > select setval('foo', (select max(some_id) from some_table)); I prefer to do it in once select like this: select setval('foo', max(some_id)) from some_table; -- ⚂⚃ 100% natural