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

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to