Re: Skipping numbers in a sequence.
От | ghaverla@freenet.edmonton.ab.ca |
---|---|
Тема | Re: Skipping numbers in a sequence. |
Дата | |
Msg-id | Pine.A41.3.95.1001124055005.24354A-100000@freenet.edmonton.ab.ca обсуждение исходный текст |
Ответ на | Re: Skipping numbers in a sequence. (GH <grasshacker@over-yonder.net>) |
Список | pgsql-novice |
On Fri, 24 Nov 2000, GH wrote: > 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? What happens when you try to increment by 1, a number stored in a float 8 which is (much) bigger than MAXVAL, but still smaller than what a float 8 can hold? Absolutely nothing. A numerical test of equality shows the 2 numbers are equal. You have to stick with some kind of integer, but it will have to be spread across multiple words. If int4 isn't big enough, int6 (your home-made int 6 that is) would probably be big enough. If heat death really bothers you, try int 8. There should be stuff in the GNU multi-precision library or perl (bit vectors I think) which would let you write this sort of stuff. Gord Matter Realisations http://www.materialisations.com/ Gordon Haverland, B.Sc. M.Eng. President 101 9504 182 St. NW Edmonton, AB, CA T5T 3A7 780/481-8019 ghaverla @ freenet.edmonton.ab.ca 780/993-1274 (cell)
В списке pgsql-novice по дате отправления: