Hi all,

I'm trying to guess the size of int8...

hygea=> insert into b values (9223372036854775296);
NOTICE:  Integer input '9223372036854775296' is out of range; promoted to float
ERROR:  Floating point conversion to int64 is out of range
hygea=> select * from b;
                 i8
-------------------
9223372036854775807
9223372036854774784
(2 rows)

hygea=> update b set i8=i8+1;
UPDATE 2
hygea=> select * from b;
                  i8
--------------------
-9223372036854775808
 9223372036854774785
(2 rows)


-Jose'-



Thu, 5 Nov 1998 16:11:35 +0100
Sferacarta Software <sferac@bo.nettuno.it>
int8  size
> I'm trying to guess the size of int8...
> 
> hygea=> insert into b values (9223372036854775296);
> NOTICE:  Integer input '9223372036854775296' is out of range; promoted to float
> ERROR:  Floating point conversion to int64 is out of range

Try
  insert into b values ('9223372036854775296'::int8);

Otherwise the Postgres parser tries to read it as a number first, can't
do it as an int4, so forces it to float8, and then fails to convert back
to int64. The User's Guide talks about int8 and mentions that it allows
more than 18 decimal places, but isn't as specific as you might like.
The actual limit is probably +/- (2^63)-1

Hmm. On my linux/libc5 box, the number seems to peg at the top no matter
how big the input:

tgl=> select '9223372036854775296'::int8;
-------------------
9223372036854775296

tgl=> select '10000000000000000000'::int8;
-------------------
9223372036854775807

tgl=> select '100000000000000000000'::int8;
-------------------
9223372036854775807

Not so good...

                   - Tom

Thu, 05 Nov 1998 16:25:18 +0000
"Thomas G. Lockhart" <lockhart@alumni.caltech.edu>
Re: [HACKERS] int8  size