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 3767C2F6.CC011A4E@alumni.caltech.edu
Whole thread Raw
In response to RE: [HACKERS] 6.5.0 - Overflow bug in AVG( )  ("Jackson, DeJuan" <djackson@cpsgroup.com>)
List pgsql-hackers
> What does the spec have to say?  It bothers me somewhat that an AVG is
> expected to return an integer result at all.  Isn't the Average of 1 and 2,
> 1.5 not 1?

Yeah, well, it's a holdover from the original Postgres code. We just
haven't made an effort to change it yet, but it seems a good candidate
for a makeover, no?

I'm pretty sure that the spec would suggest a float8 return value for
avg(int), but I haven't looked recently to refresh my memory.
               - Thomas

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


pgsql-hackers by date:

Previous
From: "Jackson, DeJuan"
Date:
Subject: RE: [HACKERS] 6.5.0 - Overflow bug in AVG( )
Next
From: José Soares
Date:
Subject: SET QUERY_LIMIT bug report