1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-22268 virtual longlong Item_func_div::int_op(): Assertion `0' failed in Item_func_div::int_op

Item_func_div::fix_length_and_dec_temporal() set the return data type to
integer in case of @div_precision_increment==0 for temporal input with FSP=0.
This caused Item_func_div to call int_op(), which is not implemented,
so a crash on DBUG_ASSERT(0) happened.

Fixing fix_length_and_dec_temporal() to set the result type to DECIMAL.
This commit is contained in:
Alexander Barkov
2020-06-13 09:30:04 +04:00
parent 81a08c5462
commit 6c30bc2181
4 changed files with 61 additions and 7 deletions

View File

@ -4772,7 +4772,7 @@ bool Type_handler_decimal_result::
bool Type_handler_temporal_result::
Item_func_plus_fix_length_and_dec(Item_func_plus *item) const
{
item->fix_length_and_dec_temporal();
item->fix_length_and_dec_temporal(true);
return false;
}
@ -4821,7 +4821,7 @@ bool Type_handler_decimal_result::
bool Type_handler_temporal_result::
Item_func_minus_fix_length_and_dec(Item_func_minus *item) const
{
item->fix_length_and_dec_temporal();
item->fix_length_and_dec_temporal(true);
return false;
}
@ -4870,7 +4870,7 @@ bool Type_handler_decimal_result::
bool Type_handler_temporal_result::
Item_func_mul_fix_length_and_dec(Item_func_mul *item) const
{
item->fix_length_and_dec_temporal();
item->fix_length_and_dec_temporal(true);
return false;
}
@ -4919,7 +4919,8 @@ bool Type_handler_decimal_result::
bool Type_handler_temporal_result::
Item_func_div_fix_length_and_dec(Item_func_div *item) const
{
item->fix_length_and_dec_temporal();
// Item_func_div::int_op() is not implemented. Disallow DECIMAL->INT downcast.
item->fix_length_and_dec_temporal(false);
return false;
}
@ -4968,7 +4969,7 @@ bool Type_handler_decimal_result::
bool Type_handler_temporal_result::
Item_func_mod_fix_length_and_dec(Item_func_mod *item) const
{
item->fix_length_and_dec_temporal();
item->fix_length_and_dec_temporal(true);
return false;
}