Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C3F614761FD; Wed, 4 Dec 2002 13:00:02 -0500 (EST) Received: from anchor-post-39.mail.demon.net (anchor-post-39.mail.demon.net [194.217.242.80]) by postgresql.org (Postfix) with ESMTP id A18A5476513; Wed, 4 Dec 2002 12:54:02 -0500 (EST) Received: from lfix.demon.co.uk ([158.152.59.127] helo=linda.lfix.co.uk) by anchor-post-39.mail.demon.net with esmtp (Exim 3.36 #2) id 18Jdip-0002Sq-0U; Wed, 04 Dec 2002 17:54:07 +0000 Received: from localhost ([127.0.0.1] ident=olly) by linda.lfix.co.uk with esmtp (Exim 3.36 #1 (Debian)) id 18Jdip-0003WZ-00; Wed, 04 Dec 2002 17:54:07 +0000 Subject: Re: [HACKERS] how to alter sequence. From: Oliver Elphick To: Dustin Sallings Cc: Hannu Krosing , raja kumar thatte , "pgsql-hackers@postgresql.org" , pgsql-admin@postgresql.org In-Reply-To: References: <20021204122900.96540.qmail@web20608.mail.yahoo.com> <1039010812.11433.75.camel@linda.lfix.co.uk> <1039016518.2281.17.camel@rh72.home.ee> Content-Type: text/plain Organization: LFIX Limited Message-Id: <1039024446.11430.566.camel@linda.lfix.co.uk> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 04 Dec 2002 17:54:07 +0000 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/38 X-Sequence-Number: 6533 On Wed, 2002-12-04 at 17:33, Dustin Sallings wrote: > What's wrong with this: > > dustin=# create sequence test_seq; > CREATE SEQUENCE > dustin=# select nextval('test_seq'); > nextval > --------- > 1 > (1 row) > > dustin=# select setval('test_seq', 9999); > setval > -------- > 9999 > (1 row) > > dustin=# select nextval('test_seq'); > nextval > --------- > 10000 > (1 row) It's not the issue. The original question was how to change the upper limit of the sequence's range, not its current value. junk=# create sequence foo_seq maxvalue 3000; CREATE SEQUENCE junk=# select nextval('foo_seq'); nextval --------- 1 (1 row) junk=# select setval('foo_seq', 999999); ERROR: foo_seq.setval: value 999999 is out of bounds (1,3000) -- Oliver Elphick LFIX Limited