Re: [QUESTIONS] Error on PostgreSQL agregate SUM() function?? - Mailing list pgsql-hackers

From Thomas G. Lockhart
Subject Re: [QUESTIONS] Error on PostgreSQL agregate SUM() function??
Date
Msg-id 34E1B598.D800CC81@alumni.caltech.edu
Whole thread Raw
Responses Re: [HACKERS] Re: [QUESTIONS] Error on PostgreSQL agregate SUM() function??  (The Hermit Hacker <scrappy@hub.org>)
Re: [QUESTIONS] Error on PostgreSQL agregate SUM() function??  (sferac@bo.nettuno.it)
List pgsql-hackers
> PostgreSQL SUMs population column given -1523690296 (overflow)
> While SOLID and MySQL gives 2771277000.
>
> Who are right PostgreSQL or SOLID and MySQL ?

Duh.

> Is it correct to have an overflow with SUM() function ?

Do you know what technique Solid and/or MySQL use to allow an integer summation to
exceed the range of a signed 32-bit integer? Do they do summations using floating
point? Let us know...

                                                  - Tom

> name      | population
> ----------+-----------
> RUSSIA    |  281170000
> INDIA     |  766140000
> CHINA     | 1072220000
> JAPAN     |  129947000
> CANADA    |   25610000
> U.S.A.    |  242080000
> MEXICO    |   81160000
> BRAZIL    |  141450000
> ARGENTINA |   31500000
>
> postgres=> select sum(populazione) from nations;
>         sum
> -----------
> -1523690296
>
> mysql> select sum( populazione) from nations;
> 1 row in set (0.05 sec)
> +-------------------+
> | sum( population)  |
> +-------------------+
> |        2771277000 |
> +-------------------+
>
> SOLID SQL Editor (teletype) v.02.20.0007
> (C) Copyright Solid Information Technology Ltd 1993-1997
> Execute SQL statements terminated by a semicolon.
> Exit by giving command: exit;
> Connected to default server.
>
> select sum(population) from nations;
> SUM(POPULATION)
> ----------------
>     2771277000
> 1 rows fetched.


pgsql-hackers by date:

Previous
From: jwieck@debis.com (Jan Wieck)
Date:
Subject: Re: [HACKERS] rule system, perl and other good stuff
Next
From: darcy@druid.net (D'Arcy J.M. Cain)
Date:
Subject: Re: [HACKERS] PL/Tcl