Commit fa56a9d5 authored by hf@deer.(none)'s avatar hf@deer.(none)

Additional fix for bug #13573

parent 3f76925d
......@@ -1124,6 +1124,7 @@ my_decimal *Item_func_div::decimal_op(my_decimal *decimal_value)
{
my_decimal value1, *val1;
my_decimal value2, *val2;
int err;
val1= args[0]->val_decimal(&value1);
if ((null_value= args[0]->null_value))
......@@ -1131,17 +1132,15 @@ my_decimal *Item_func_div::decimal_op(my_decimal *decimal_value)
val2= args[1]->val_decimal(&value2);
if ((null_value= args[1]->null_value))
return 0;
switch (my_decimal_div(E_DEC_FATAL_ERROR & ~E_DEC_DIV_ZERO, decimal_value,
val1, val2, prec_increment)) {
case E_DEC_TRUNCATED:
case E_DEC_OK:
return decimal_value;
case E_DEC_DIV_ZERO:
signal_divide_by_null();
default:
null_value= 1; // Safety
if ((err= my_decimal_div(E_DEC_FATAL_ERROR & ~E_DEC_DIV_ZERO, decimal_value,
val1, val2, prec_increment)) > 3)
{
if (err == E_DEC_DIV_ZERO)
signal_divide_by_null();
null_value= 1;
return 0;
}
return decimal_value;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment