Re: 21 bit number for sequence - Mailing list pgsql-general

From Shoaib Mir
Subject Re: 21 bit number for sequence
Date
Msg-id bf54be870604150111s28e0f0albb2a80a9813157a7@mail.gmail.com
Whole thread Raw
In response to Re: 21 bit number for sequence  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: 21 bit number for sequence  (Christian Kratzer <ck@cksoft.de>)
Re: 21 bit number for sequence  ("Dawid Kuroczko" <qnex42@gmail.com>)
List pgsql-general
Actually that is the application requirment to use 21 bit numbers as porting it from Oracle where it used to work.

Yeah now i have decided to use a numeric data type in a table and use that to write my own nextval and currval functions for that purpose.

Thanks for the help.

/Shoaib

On 4/15/06, Martijn van Oosterhout <kleptog@svana.org> wrote:
On Sat, Apr 15, 2006 at 12:52:49PM +0500, Shoaib Mir wrote:
> Actually what i want to do is store 100000000000000100000 as the maximum
> value in sequence. Is there a way for it ?

Is that number in binary or decimal? In binary it's easy because it's
only 1048608 decimal. In decimal it would require 66 bits, which
doesn't fit. The is still: why do you want a *sequence* to go that
high? A sequence starts counting a 1 and goes up until the limit. At
one count per second you'd take several million million years to get
though. Bigint indeed only goes upto 9223372036854775807.

If you just want to store numbers, use numeric. Why do you want to
combine numeric and a sequence?
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFEQKhuIB7bNG8LQkwRAkOpAJ0cRCABC2OmbDDVqNcPuAT0WjADdQCcDkGq
dzC7ykqq/h6YhWpgDJIQ0kk=
=YZzx
-----END PGP SIGNATURE-----



pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: 21 bit number for sequence
Next
From: Kari Pahula
Date:
Subject: Re: Curious UDP packets