Re: [GENERAL] Should SERIAL column have MAXVAL set on sequence

From: Jim Nasby <decibel(at)decibel(dot)org>
To: Woody Woodring <george(dot)woodring(at)iglass(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: [GENERAL] Should SERIAL column have MAXVAL set on sequence
Date: 2007-07-24 18:52:12
Message-ID: B54B4160-317E-4E60-B939-04EE0D03260A@decibel.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-general

Moving to -bugs.

On Jul 23, 2007, at 9:02 AM, Woody Woodring wrote:
> I have a table in our DB that functions as a queue with a SERIAL
> column for
> its primary key. At 4am this weekend I started getting the error:
>
> ERROR: integer out of range
>
> Which was attributed to the sequence incrementing past the size of
> the int4
> serial column after several years of operation.
>
> I was able to set the sequence back to 1 and everything was happy.
>
> I was wondering if the SERIAL column should set the
> MAXVAL=2147483647 when
> it creates the sequence?
>
> I ended up fixing my queue table with the following to avoid the
> issue in
> the future:
>
> ALTER SEQUENCE transfer_transferid_seq MAXVALUE 2147483647 CYCLE;

I can confirm this is still the case in HEAD:

decibel=# select max_value from s_s_seq ;
max_value
---------------------
9223372036854775807
(1 row)

This does seem like a bug...
--
Jim Nasby jim(at)nasby(dot)net
EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Zoltan Boszormenyi 2007-07-24 19:19:55 Re: [GENERAL] Should SERIAL column have MAXVAL set on sequence
Previous Message Harald Armin Massa 2007-07-24 16:06:34 Re: BUG #3482: Postgresql DB does not start when lanuched via .bat

Browse pgsql-general by date

  From Date Subject
Next Message Jim Nasby 2007-07-24 18:55:01 Re: Will partial index creation use existing index?
Previous Message Jim Nasby 2007-07-24 18:49:54 Re: spool function in nbtree index