Re: About PostgreSQL's limit on arithmetic operations - Mailing list pgsql-general

From Shridhar Daithankar
Subject Re: About PostgreSQL's limit on arithmetic operations
Date
Msg-id 200409291359.17494.shridhar@frodo.hserus.net
Whole thread Raw
In response to About PostgreSQL's limit on arithmetic operations  (Devrim GUNDUZ <devrim@gunduz.org>)
Responses Re: About PostgreSQL's limit on arithmetic operations
List pgsql-general
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.


shridhar@ps0499:~$ 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


pgsql-general by date:

Previous
From: Devrim GUNDUZ
Date:
Subject: About PostgreSQL's limit on arithmetic operations
Next
From: Sim Zacks
Date:
Subject: sql script confusion