summaryrefslogtreecommitdiff
path: root/mysql-test/r/have_latin2_ch.require
diff options
context:
space:
mode:
authorunknown <kaa@kaamos.(none)>2008-03-06 18:19:47 +0300
committerunknown <kaa@kaamos.(none)>2008-03-06 18:19:47 +0300
commit8270d9875ff44900f3c57c15711c03d0b83cbe5d (patch)
tree70b4e94747923d70161e799b874a3d59a8c57e66 /mysql-test/r/have_latin2_ch.require
parent64bdb0bdf2821cb4021649797e02a4ed98cf86e7 (diff)
downloadmariadb-git-8270d9875ff44900f3c57c15711c03d0b83cbe5d.tar.gz
Fix for bug #34512: CAST( AVG( double ) AS DECIMAL )
returns wrong results Casting AVG() to DECIMAL led to incorrect results when the arguments had a non-DECIMAL type, because in this case Item_sum_avg::val_decimal() performed the division by the number of arguments twice. Fixed by changing Item_sum_avg::val_decimal() to not rely on Item_sum_sum::val_decimal(), i.e. calculate sum and divide using DECIMAL arithmetics for DECIMAL arguments, and utilize val_real() with subsequent conversion to DECIMAL otherwise. mysql-test/r/func_group.result: Added a test case for bug #34512. mysql-test/t/func_group.test: Added a test case for bug #34512. sql/item_sum.cc: Do not use Item_sum_sum::val_decimal() in Item_sum_avg::val_decimal() because the first one, depending on the arguments type, may return either the sum of the arguments, or the average calculated by the virtual val_real() method of Item_sum_avg. Instead, do our own calculation based on the arguments type.
Diffstat (limited to 'mysql-test/r/have_latin2_ch.require')
0 files changed, 0 insertions, 0 deletions