diff options
author | kaa@kaamos.(none) <> | 2008-03-19 14:25:36 +0300 |
---|---|---|
committer | kaa@kaamos.(none) <> | 2008-03-19 14:25:36 +0300 |
commit | e7d169fbdea089fab3d111e5e4ecf1ce2edad614 (patch) | |
tree | e5616a3156ac5506cc8a5ce194ecad7054282c34 /sql/item_sum.cc | |
parent | 95fd6879c54d210e6145809df3732d87695b5981 (diff) | |
parent | 4ca61aa36e5538edfd2cc2e21ca1be0964dda367 (diff) | |
download | mariadb-git-e7d169fbdea089fab3d111e5e4ecf1ce2edad614.tar.gz |
Merge kaamos.(none):/data/src/opt/bug34512/my50
into kaamos.(none):/data/src/opt/bug34512/my51
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r-- | sql/item_sum.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 96effc36485..3d9488ad324 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; |