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

MDEV-23311 CEILING() and FLOOR() convert temporal input to numbers, unlike ROUND() and TRUNCATE()

Fixing functions CEILING and FLOOR to return
- TIME for TIME input
- DATETIME for DATETIME and TIMESTAMP input
This commit is contained in:
Alexander Barkov
2020-07-28 17:32:19 +04:00
parent 69cf6302f3
commit 5b3b53ce36
14 changed files with 827 additions and 12 deletions

View File

@ -980,7 +980,7 @@ bool Temporal::datetime_round_or_invalidate(THD *thd, uint dec, int *warn, ulong
DBUG_ASSERT(dec <= TIME_SECOND_PART_DIGITS);
if (datetime_add_nanoseconds_or_invalidate(thd, warn, nsec))
return true;
my_time_trunc(this, dec);
my_datetime_trunc(this, dec);
return false;
}
@ -5732,6 +5732,22 @@ bool Type_handler_int_result::
}
bool Type_handler_typelib::
Item_func_int_val_fix_length_and_dec(Item_func_int_val *item) const
{
item->fix_length_and_dec_int_or_decimal();
return false;
}
bool Type_handler_hex_hybrid::
Item_func_int_val_fix_length_and_dec(Item_func_int_val *item) const
{
item->fix_length_and_dec_int_or_decimal();
return false;
}
bool Type_handler_real_result::
Item_func_int_val_fix_length_and_dec(Item_func_int_val *item) const
{
@ -5756,6 +5772,30 @@ bool Type_handler_temporal_result::
}
bool Type_handler_time_common::
Item_func_int_val_fix_length_and_dec(Item_func_int_val *item) const
{
item->fix_length_and_dec_time();
return false;
}
bool Type_handler_datetime_common::
Item_func_int_val_fix_length_and_dec(Item_func_int_val *item) const
{
item->fix_length_and_dec_datetime();
return false;
}
bool Type_handler_timestamp_common::
Item_func_int_val_fix_length_and_dec(Item_func_int_val *item) const
{
item->fix_length_and_dec_datetime();
return false;
}
bool Type_handler_string_result::
Item_func_int_val_fix_length_and_dec(Item_func_int_val *item) const
{