pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
change max_value in sequence
3+ messages / 3 participants
[nested] [flat]

* change max_value in sequence
@ 2008-09-05 12:58  Claus Guttesen <kometen@gmail.com>
  0 siblings, 2 replies; 3+ messages in thread

From: Claus Guttesen @ 2008-09-05 12:58 UTC (permalink / raw)
  To: pgsql-admin

Hi.

I have a table with a serial field defined with an older version of
postgresql (ver. 7). Back then max_value was 2147483647:

select max_value from my_bid_seq ;
max_value
------------
2147483647

How can I increase it? By updating the max_value-field? This is an
older thread and may have changed:
http://archives.postgresql.org/pgsql-admin/2002-12/msg00033.php

I'm running postgresql 8.3.1.

-- 
regards
Claus

When lenity and cruelty play for a kingdom,
the gentler gamester is the soonest winner.

Shakespeare



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: change max_value in sequence
@ 2008-09-05 13:52  Scott Marlowe <scott.marlowe@gmail.com>
  parent: Claus Guttesen <kometen@gmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Scott Marlowe @ 2008-09-05 13:52 UTC (permalink / raw)
  To: Claus Guttesen <kometen@gmail.com>; +Cc: pgsql-admin

On Fri, Sep 5, 2008 at 6:58 AM, Claus Guttesen <kometen@gmail.com> wrote:
> Hi.
>
> I have a table with a serial field defined with an older version of
> postgresql (ver. 7). Back then max_value was 2147483647:
>
> select max_value from my_bid_seq ;
> max_value
> ------------
> 2147483647
>
> How can I increase it? By updating the max_value-field? This is an
> older thread and may have changed:
> http://archives.postgresql.org/pgsql-admin/2002-12/msg00033.php

That's the max for a regular int / serial type.  You'll need to change
it to bigserial / bigint which is 64 bits/

>
> I'm running postgresql 8.3.1.

Please update to 8.3.3



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: change max_value in sequence
@ 2008-09-05 15:39  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Claus Guttesen <kometen@gmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2008-09-05 15:39 UTC (permalink / raw)
  To: Claus Guttesen <kometen@gmail.com>; +Cc: pgsql-admin

"Claus Guttesen" <kometen@gmail.com> writes:
> I have a table with a serial field defined with an older version of
> postgresql (ver. 7). Back then max_value was 2147483647:
> How can I increase it? By updating the max_value-field?

I think you're looking for ALTER SEQUENCE.

Note that if the column it's feeding into is int4, you'd also need to
alter the column type ...

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2008-09-05 15:39 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-09-05 12:58 change max_value in sequence Claus Guttesen <kometen@gmail.com>
2008-09-05 13:52 ` Scott Marlowe <scott.marlowe@gmail.com>
2008-09-05 15:39 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox