Re: [HACKERS] how to alter sequence.
Oliver Elphick <olly@lfix.co.uk>
From: Oliver Elphick <olly@lfix.co.uk>
To: Dustin Sallings <dustin@spy.net>
Cc: Hannu Krosing <hannu@tm.ee>, raja kumar thatte <trajakumar@yahoo.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>, pgsql-admin@postgresql.org
Date: 2002-12-04T17:54:07Z
Lists: pgsql-hackers
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 <olly@lfix.co.uk>
LFIX Limited