Commit 9c1130e2 authored by unknown's avatar unknown
Browse files

Fix for bug #8651 (cast(sum(distinct) as decimal) crashes the server)


sql/item_sum.cc:
  curr_dec_buff should be set to 0 here
parent 9a148273
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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);
}