diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 33cff192d06..9a4798b9dc9 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -656,7 +656,8 @@ my_decimal *Item_sum_sum_distinct::val_decimal(my_decimal *fake) else { double real= val_real(); - double2my_decimal(E_DEC_FATAL_ERROR, real, dec_buffs + curr_dec_buff); + curr_dec_buff= 0; + double2my_decimal(E_DEC_FATAL_ERROR, real, dec_buffs); } return(dec_buffs + curr_dec_buff); }