[ http://issues.apache.org/jira/browse/DERBY-131?page=comments#action_58057 ] Satheesh Bandaram commented on DERBY-131: -----------------------------------------
I agree with Jeremy's comments here. Returning Double for avg() of Integers seems incorrect. Also, it is possible to make avg() return Double, if the application chooses, by casting the argument to Double as: ij> select avg(cast(i as double)) from t1; 1 ---------------------- 1.5 1 row selected ij> select avg(i) from t1; 1 ----------- 1 1 row selected > AVG precision is INTEGER instead of DOUBLE > ------------------------------------------ > > Key: DERBY-131 > URL: http://issues.apache.org/jira/browse/DERBY-131 > Project: Derby > Type: Bug > Components: SQL > Versions: 10.0.2.1 > Reporter: Rainer Gemulla > > The AVG aggregator returns an INTEGER value, if the data tyoe of the > respective attribute is INTEGER. This is wrong, because the average of a set > of integers is not always an integer, too. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira
