On Wednesday 29 Sep 2004 1:11 pm, Devrim GUNDUZ wrote: > Hi, > > We were performing some tests on PostgreSQL and found that it fails on the > following query: > > SELECT 512*18014398509481984 AS result; > > and the result is: > > result > ---------------------- > -9223372036854775808 > > It should be 9223372036854775808... This is PostgreSQL 7.4.5 on Fedora > Core 2.
[EMAIL PROTECTED]:~$ psql template1 Welcome to psql 8.0.0beta2, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help with psql commands \g or terminate with semicolon to execute query \q to quit template1=# SELECT 512*18014398509481984 AS result; result ---------------------- -9223372036854775808 (1 row) template1=# SELECT 512*18014398509481984::bigint AS result; result ---------------------- -9223372036854775808 (1 row) template1=# SELECT 512*18014398509481984::numeric(20) AS result; result --------------------- 9223372036854775808 (1 row) template1=# select version(); version ----------------------------------------------------------------------------- PostgreSQL 8.0.0beta2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.4 (1 row) Shridhar ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match