Re: [ADMIN] how to alter sequence. - Mailing list pgsql-hackers

From Oliver Elphick
Subject Re: [ADMIN] how to alter sequence.
Date
Msg-id 1039024446.11430.566.camel@linda.lfix.co.uk
Whole thread Raw
In response to Re: [ADMIN] how to alter sequence.  (Dustin Sallings <dustin@spy.net>)
List 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


pgsql-hackers by date:

Previous
From: Dustin Sallings
Date:
Subject: Re: [ADMIN] how to alter sequence.
Next
From: Rod Taylor
Date:
Subject: Re: interesting difference for queries...