Re: [HACKERS] how to alter sequence.

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Dustin Sallings <dustin(at)spy(dot)net>
Cc: Hannu Krosing <hannu(at)tm(dot)ee>, raja kumar thatte <trajakumar(at)yahoo(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, pgsql-admin(at)postgresql(dot)org
Subject: Re: [HACKERS] how to alter sequence.
Date: 2002-12-04 17:54:07
Message-ID: 1039024446.11430.566.camel@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin 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(at)lfix(dot)co(dot)uk>
LFIX Limited

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Bruce Momjian 2002-12-04 18:23:40 Re: how to alter sequence.
Previous Message Dustin Sallings 2002-12-04 17:50:20 Re: [HACKERS] how to alter sequence.

Browse pgsql-hackers by date

  From Date Subject
Next Message Rod Taylor 2002-12-04 17:55:18 Re: interesting difference for queries...
Previous Message Dustin Sallings 2002-12-04 17:50:20 Re: [HACKERS] how to alter sequence.