> 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.