Re: About PostgreSQL's limit on arithmetic operations
От | Shridhar Daithankar |
---|---|
Тема | Re: About PostgreSQL's limit on arithmetic operations |
Дата | |
Msg-id | 200409291651.31091.shridhar@frodo.hserus.net обсуждение исходный текст |
Ответ на | Re: About PostgreSQL's limit on arithmetic operations (Devrim GUNDUZ <devrim@gunduz.org>) |
Ответы |
Re: About PostgreSQL's limit on arithmetic operations
Re: About PostgreSQL's limit on arithmetic operations |
Список | pgsql-general |
On Wednesday 29 Sep 2004 2:25 pm, Devrim GUNDUZ wrote: > > template1=# SELECT 512*18014398509481984::numeric(20) AS result; > > result > > --------------------- > > 9223372036854775808 > > (1 row) > > Ok, I got the same result in 7.4.5... But... Why do we have to cast it > into numeric? The results from other databases shows that they can perform > it without casting... Probably because the normal integer is 4 bytes long and bigint is 8 bytes long. The value above is exactly 2^63 at which a 8 bytes long signed bigint should flip sign/overflow. I am still puzzled with correct value and negative sign.. For arbitrary precision integer, you have to use numeric. It is not same as oracle. Furthermore if your number fit in range, then numbers like precision(4,0) in oracle to smallint in postgresql would buy you huge speed improvement(compared to postgresql numeric I mean) Please correct me if I am wrong.. Shridhar
В списке pgsql-general по дате отправления: