From a874b6c4459a2dd028d6c4a15e43eeb556183de0 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Thu, 30 Jul 2020 14:30:21 +0400 Subject: MDEV-23337 Rounding functions create a wrong data type for integer input 1. Fixing ROUND(x) and TRUNCATE(x,0) with TINYINT, SMALLINT, MEDIUMINT, BIGINT input to preserve the exact data type of the argument when it's possible. 2. Fixing FLOOR(x) and CEILING(x) with TINYINT, SMALLINT, MEDIUMINT, BIGINT to preserve the exact data type of the argument. 3. Adding dedicated Type_handler_year::Item_func_round_fix_length_and_dec() to easier handle ROUND(x) and TRUNCATE(x,y) for the YEAR(2) and YEAR(4) input. They still return INT(2) UNSIGNED and INT(4) UNSIGNED correspondingly, as before. --- sql/item_func.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql/item_func.h') diff --git a/sql/item_func.h b/sql/item_func.h index d1ebf98ccda..549e576dbd3 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -1774,7 +1774,7 @@ public: return NULL; } void fix_arg_decimal(); - void fix_arg_int(); + void fix_arg_int(const Type_handler *preferred); void fix_arg_double(); void fix_arg_time(); void fix_arg_datetime(); -- cgit v1.2.1