On Wed, 22 Sep 1999, Matt Bernstein wrote:
> I tried to submit a bug report online, but the bug page was "not found".
> That's definitely a bug! Please forward the SQL bug below to whoever deals
> with backend bugs.
Fixed and CC'd bugs list.
Vince.
>
> Cheers,
>
> Matt
>
> --8<----8<----8<--
>
> BUG in AVG() ???
>
> Observe this (in psql):
>
> --8<--
>
> mcsbeta4=> \d cregistrations
> Table = cregistrations
> +----------------------------------+----------------------------------+-------+
> | Field | Type |
> Length|
> +----------------------------------+----------------------------------+-------+
> | candno | text |
> var |
> | student | text not null |
> var |
> | course | text not null |
> var |
> | cattempt | int2 |
> 2 |
> | ayear | text not null default defaultaye |
> var |
> | cwptoverall | numeric | 5.2
> |
> | examresult | numeric | 5.2
> |
> | result | numeric | 5.2
> |
> | finalresult | numeric | 5.2
> |
> | resultcode | text |
> var |
> | progressioncode | text |
> var |
> +----------------------------------+----------------------------------+-------+
> Index: cregistrations_pkey
>
> mcsbeta4=> select AVG(examresult) from cregistrations;
> ERROR: overflow on numeric ABS(value) >= 10^-1 for field with precision 0
> scale 1723
> mcsbeta4=> select SUM(examresult)/COUNT(examresult) from cregistrations;
> ?column?
> -------------
> 44.2075493061
> (1 row)
>
> --8<--
>
> Why does AVG(examresult) fail where SUM(examresult)/COUNT(examresult)
> succeeds? Bizarre :)
>
>
--
==========================================================================
Vince Vielhaber -- KA8CSH email: vev@michvhf.com flame-mail: /dev/null
# include <std/disclaimers.h> TEAM-OS2
Online Campground Directory http://www.camping-usa.com
Online Giftshop Superstore http://www.cloudninegifts.com
==========================================================================