Re: [HACKERS] int8 size

Поиск
Список
Период
Сортировка
От Thomas G. Lockhart
Тема Re: [HACKERS] int8 size
Дата
Msg-id 3641D16E.FA29AB9E@alumni.caltech.edu
обсуждение исходный текст
Ответ на int8 size  (Sferacarta Software <sferac@bo.nettuno.it>)
Список 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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Thomas G. Lockhart"
Дата:
Сообщение: Re: [HACKERS] Re: bug on aggregate function AVG()
Следующее
От: Constantin Teodorescu
Дата:
Сообщение: crypt not included when compiling libpgtcl !!!!!!!