Re: serial
Posted in 1999
Topics: Data Types & Schema Design
From: "Martie Parten" <Martie.Parten@SciAtl.COM> > >Well, if we're gettin' picky, TFM says ya have to start with a number >greater than 0. So, the max value for serial (which was the original >question, I think) is 2,147,483,647 or (2^31)-1, (in base 10, >1111111111111111111111111111111 binary, 17777777777 octal, 7FFFFFFF hex >..... *slap*.... whew, thanks, I'll be ok now!) Promoting violence against women, are we? :-) *Anyway*, serial data types will accept values less than 0 (I've just tried this :-), but the autogeneration of serial numbers is always for positive numbers only. In other words, you can use numbers < 0, but you have to maintain those yourself. And you can't create a serial column to handle a negative number. Well, *I* couldn't... :-) So (to be picky) a serial can cope with a number range of 2^32 -1, but will only autogenerate 2^31 -1 of those... Can someone please slap *me* now? (Not all at once, hear! :-) >I like giving them the invoices, too :) I prefer it when they pay 'em... :-) ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com
>Anyway*, serial data types will accept values less than 0 (I've just tried >this :-), but the autogeneration of serial numbers is always for positive Sorry but I don't think this is *always* the case - I think the the positive numbers are exhausted then negative numbers will start to be allocated until that too is exhausted.
Robert Taylor wrote: > >Anyway*, serial data types will accept values less than 0 > >(I've just tried this :-), but the autogeneration of serial > > numbers is always for positive > > Sorry but I don't think this is *always* the case - I think the > positive numbers are exhausted then negative numbers will start > to be allocated until that too is exhausted. No, after you insert the record with serial value 2^31-1, the next record will have serial value 1. This insert will fail, of course, if there is still a unique index on the column and the record with value 1 also still exists. -- Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) Guardian of DBD::Informix v0.60 -- see http://www.perl.com/CPAN #include <disclaimer.h>