Received: from anchor-post-34.mail.demon.net (anchor-post-34.mail.demon.net [194.217.242.92]) by postgresql.org (Postfix) with ESMTP id 902C847583B for ; Thu, 21 Mar 2002 14:01:27 -0500 (EST) Received: from lfix.demon.co.uk ([158.152.59.127] helo=linda.lfix.co.uk) by anchor-post-34.mail.demon.net with esmtp (Exim 3.35 #1) id 16o7oU-000Ll6-0Y; Thu, 21 Mar 2002 19:01:27 +0000 Received: from localhost ([127.0.0.1] helo=localhost.localdomain ident=olly) by linda.lfix.co.uk with esmtp (Exim 3.35 #1 (Debian)) id 16o7oT-00011z-00; Thu, 21 Mar 2002 19:01:25 +0000 Subject: Re: Sequence not updated after a copy ? From: Oliver Elphick To: GRIMOIS Eric Cc: pgsql-sql@postgresql.org In-Reply-To: <000c01c1d0fc$e36d1f40$3d04a837@PXXXX> References: <000c01c1d0fc$e36d1f40$3d04a837@PXXXX> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Evolution/1.0.2 Date: 21 Mar 2002 19:01:24 +0000 Message-Id: <1016737285.21170.128.camel@linda> Mime-Version: 1.0 X-Archive-Number: 200203/281 X-Sequence-Number: 7160 On Thu, 2002-03-21 at 17:21, GRIMOIS Eric wrote: > Hi All > > Does 'COPY table FROM...' command update the last_value field of the > sequence(s) related to the table ? No > Is a setval( ) function required after completion ? In this case, what's the > best command for doing that ? SELECT setval('sequence_name', (SELECT MAX(column_name) FROM table_name) ); -- Oliver Elphick Oliver.Elphick@lfix.co.uk Isle of Wight http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C "Thy word have I hid in mine heart, that I might not sin against thee." Psalms 119:11