Re: [HACKERS] 6.5.0 - Overflow bug in AVG( ) - Mailing list pgsql-hackers

From Thomas Lockhart
Subject Re: [HACKERS] 6.5.0 - Overflow bug in AVG( )
Date
Msg-id 3767AEBA.E7C006B9@alumni.caltech.edu
Whole thread Raw
In response to 6.5.0 - Overflow bug in AVG( )  ("Gene Sokolov" <hook@aktrad.ru>)
Responses Re: [HACKERS] 6.5.0 - Overflow bug in AVG( )
List pgsql-hackers
> Float8 accumulator seems to be a good solution if AVG is limited to
> int/float types. I wonder if it could produce system dependency in AVG due
> to rounding errors. Some broader solution should be considered though if you
> want AVG to work on numeric/decimal as well.

The implementation can be specified for each datatype individually, so
that's not a problem. afaik the way numeric/decimal work it would be
fine to use those types as their own accumulators. It's mostly the
int2/int4/int8 types which are the problem, since they silently
overflow (on most machines?).
                    - Thomas

-- 
Thomas Lockhart                lockhart@alumni.caltech.edu
South Pasadena, California


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Savepoints...
Next
From: wieck@debis.com (Jan Wieck)
Date:
Subject: Re: [HACKERS] 6.5.0 - Overflow bug in AVG( )