Re: Serial Unique question

From: Sven Willenberger <sven(at)dmv(dot)com>
To: Madison Kelly <linux(at)alteeve(dot)com>
Cc: Douglas McNaught <doug(at)mcnaught(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: Serial Unique question
Date: 2005-08-15 16:12:15
Message-ID: 1124122335.8467.27.camel@lanshark.dmv.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 2005-08-15 at 11:48 -0400, Madison Kelly wrote:
> Douglas McNaught wrote:
> > Madison Kelly <linux(at)alteeve(dot)com> writes:
> >
> >
> >> I want to use a 'serial uniue' column in a table but there is
> >> likely to be many, many inserts and deletes from this column. I was
> >> wondering, what happens when the serial value reaches
> >> 2,147,483,647'? Does it roll back over to '1' and keep going or
> >> will the database start erroring out? This isn't likely to be a
> >> problem any time soon, but over the course of a year or more it
> >> might be.
> >
> >
> > Use a "bigserial" instead?
> >
> > -Doug
> >
>
> Same issue, delaying a potential problem, not addressing it. :)
>
> Madison
>
\h CREATE SEQUENCE
Command: CREATE SEQUENCE
Description: define a new sequence generator
Syntax:
CREATE [ TEMPORARY | TEMP ] SEQUENCE name [ INCREMENT [ BY ] increment ]
[ MINVALUE minvalue | NO MINVALUE ] [ MAXVALUE maxvalue | NO
MAXVALUE ]
[ START [ WITH ] start ] [ CACHE cache ] [ [ NO ] CYCLE ]

Based on the last argument, a sequence can be created to either cycle or
not; it would appear as though the default, when created automagically
by invoking the [big]serial "data type", is to not cycle; my guess in
that case would be that an error would be raised if you have reached
2^31 in your serial field.

Sven

Sven

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2005-08-15 16:24:30 Re: error inserting big files in DB.
Previous Message MICHAEL BATTANI 2005-08-15 15:59:00 cobol storedprocedures