summaryrefslogtreecommitdiff
path: root/sql/item_sum.cc
diff options
context:
space:
mode:
authorunknown <kaa@kaamos.(none)>2008-03-19 16:31:26 +0300
committerunknown <kaa@kaamos.(none)>2008-03-19 16:31:26 +0300
commitc0ba9a9eef0719167297bafc09cab7c62cc1733e (patch)
treefaac6f1e1a397791874558807382471c3c5cecaf /sql/item_sum.cc
parent842fd8ba5e3e5c6f1d3f545a1e263e0582e02ddd (diff)
parente829d36367a831974d081d8fa7cb9273204b5b25 (diff)
downloadmariadb-git-c0ba9a9eef0719167297bafc09cab7c62cc1733e.tar.gz
Merge kaamos.(none):/data/src/opt/bug34512/my51
into kaamos.(none):/data/src/opt/mysql-5.1-opt sql/item_sum.cc: Auto merged
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r--sql/item_sum.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 4a4ee5fa73c..ce9e2ad906c 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -1228,7 +1228,15 @@ my_decimal *Item_sum_avg::val_decimal(my_decimal *val)
null_value=1;
return NULL;
}
- sum_dec= Item_sum_sum::val_decimal(&sum_buff);
+
+ /*
+ For non-DECIMAL hybrid_type the division will be done in
+ Item_sum_avg::val_real().
+ */
+ if (hybrid_type != DECIMAL_RESULT)
+ return val_decimal_from_real(val);
+
+ sum_dec= dec_buffs + curr_dec_buff;
int2my_decimal(E_DEC_FATAL_ERROR, count, 0, &cnt);
my_decimal_div(E_DEC_FATAL_ERROR, val, sum_dec, &cnt, prec_increment);
return val;