Re: [HACKERS] int8 size

From: "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu>
To: Sferacarta Software <sferac(at)bo(dot)nettuno(dot)it>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] int8 size
Date: 1998-11-05 16:25:18
Message-ID: 3641D16E.FA29AB9E@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> 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

In response to

  • int8 size at 1998-11-05 15:11:35 from Sferacarta Software

Browse pgsql-hackers by date

  From Date Subject
Next Message Constantin Teodorescu 1998-11-05 16:48:52 crypt not included when compiling libpgtcl !!!!!!!
Previous Message Thomas G. Lockhart 1998-11-05 16:00:46 Re: [HACKERS] Re: bug on aggregate function AVG()