Skip site navigation (1) Skip section navigation (2)

Re: Skipping numbers in a sequence.

From: GH <grasshacker(at)over-yonder(dot)net>
To:
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Skipping numbers in a sequence.
Date: 2000-11-24 10:25:05
Message-ID: 20001124042505.K32817@over-yonder.net (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-novice
On Fri, Nov 24, 2000 at 04:16:52AM -0600, some SMTP stream spewed forth: 
> On Fri, Nov 24, 2000 at 04:07:25AM -0600, some SMTP stream spewed forth: 
> > On Fri, Nov 24, 2000 at 09:59:17PM +1300, some SMTP stream spewed forth: 
> > > GH wrote:
> > > > Hello all.
> > > > It's like this. ;-)
> > > > I have a table with a column that has a default nextval('sequence').
> > > > The sequence is a standard increment 1 cycle sequence.
> > > > What happens when
> > > >         the sequence wraps after inserting the
> > > >                 2-million-and-whatever-th row
> 
> *snippity snip snip*
> 
> > > 
> > > I usually leave the sequence to error at 4 billion, and if that hits me
> > > before the heat-death of the universe I will sort it out then :-)
> 
> Hell, do you suppose I could just set the column to float8 and let the
> sequence run for the next several years? I would be happy if the sequence
> buys me 3 or more years. ;-)
> (Just get me to Morrocco, baby. ;-))
> 
> There would not be any problems with a sequence as high as max(float8), would
> there?

Er, to answer my own question, yes.
I seem to have discovered that the maximum maxvalue for a sequence is 
9,999,999,999 (i.e. 10 digits) -- which leads one to believe that 10 is
the max num of digits for an integer-type column.

gh

> 
> > I was thinking about something like that.
> > This table is used in such a way that each row corresponds to one item
> > in an order. So, I suppose I need to guesstimate the likely-hood that 
> > a company would sell (or have-shopped) n items. 
> > 
> > I just have that icky feeling that some day the sequence will roll over
> > and hell with come after my ass. ;-))
> > 
> 
> Thanks.
> 
> gh
> 
> > 
> > 
> > > 
> > > Cheers,
> > > 					Andrew.
> > > -- 
> > > _____________________________________________________________________
> > >             Andrew McMillan, e-mail: Andrew(at)cat-it(dot)co(dot)nz
> > > Catalyst IT Ltd, PO Box 10-225, Level 22, 105 The Terrace, Wellington
> > > Me: +64 (21) 635 694, Fax: +64 (4) 499 5596, Office: +64 (4) 499 2267

In response to

Responses

pgsql-novice by date

Next:From: GHDate: 2000-11-24 10:41:02
Subject: Re: Skipping numbers in a sequence.
Previous:From: GHDate: 2000-11-24 10:16:52
Subject: Re: Skipping numbers in a sequence.

pgsql-general by date

Next:From: GHDate: 2000-11-24 10:41:02
Subject: Re: Skipping numbers in a sequence.
Previous:From: GHDate: 2000-11-24 10:16:52
Subject: Re: Skipping numbers in a sequence.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group