Re: [QUESTIONS] Error on PostgreSQL agregate SUM() function??

From: "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu>
To: sferac(at)bo(dot)nettuno(dot)it
Cc: Postgres Hackers List <hackers(at)postgresql(dot)org>
Subject: Re: [QUESTIONS] Error on PostgreSQL agregate SUM() function??
Date: 1998-02-11 14:28:41
Message-ID: 34E1B598.D800CC81@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message D'Arcy J.M. Cain 1998-02-11 14:32:09 Re: [HACKERS] PL/Tcl
Previous Message Jan Wieck 1998-02-11 14:28:08 Re: [HACKERS] rule system, perl and other good stuff