Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id E5FAB47650A; Wed, 4 Dec 2002 09:17:11 -0500 (EST) 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 A4F8247667E; Wed, 4 Dec 2002 09:07:15 -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 18JaBC-000Eeq-0Y; Wed, 04 Dec 2002 14:07:14 +0000 Received: from localhost ([127.0.0.1] ident=olly) by linda.lfix.co.uk with esmtp (Exim 3.36 #1 (Debian)) id 18JaAu-0002mS-00; Wed, 04 Dec 2002 14:06:52 +0000 Subject: Re: how to alter sequence. From: Oliver Elphick To: raja kumar thatte Cc: pgsql-hackers@postgresql.org, pgsql-admin@postgresql.org In-Reply-To: <20021204122900.96540.qmail@web20608.mail.yahoo.com> References: <20021204122900.96540.qmail@web20608.mail.yahoo.com> Content-Type: text/plain Organization: LFIX Limited Message-Id: <1039010812.11433.75.camel@linda.lfix.co.uk> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 04 Dec 2002 14:06:52 +0000 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/34 X-Sequence-Number: 6529 On Wed, 2002-12-04 at 12:29, raja kumar thatte wrote: > Hai friends, > I have a sequence called raj_seq with max value 3000. ... > now i wanted to increase the max value of the raj_seq > to 9999999. > How to do this change? > If i drop and recreate the raj_seq, then i have to > recreate the table and all triggers working on that > table.But it is not an acceptable solution. > So with out droping raj_seq , how do I solve this > problem. Unfortunately there doesn't seem to be any easy way to do this. There is no ALTER SEQUENCE command and you can't use UPDATE on a sequence. Hackers: Could this be a TODO item for 7.4? The easiest way to do this at present is probably to dump the database, edit the dump to change the sequence max_value and then recreate the database from the edited dump. I presume you used CREATE SEQUENCE in order to get such a low max_value. If it were created from a SERIAL datatype, you would also have to edit the table definition to use a pre-created sequence. There is no means of specifying a max_value using SERIAL. -- Oliver Elphick LFIX Limited