mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
A cleanup for the patch for MDEV-12852, MDEV-12853, MDEV-12869
The patch broke expressions like CAST(1.0e+300 AS SIGNED INT) in binary protocol, e.g.: mtr --ps cast Short real numbers like 1.0e+300 can return huge values, so using args[0]->max_length is not reliable to choose properly the result type for Item_func_signed and Item_func_unsigned (between INT and BIGINT). Setting Item_[un]signed_typecast::max_length to MAX_BIGINT_WIDTH when doing CAST from FLOAT/DOUBLE, to force type_handler() return &type_handler_longlong rather than &type_handler_long.
This commit is contained in:
parent
6a779a6d28
commit
62b62319bf
3 changed files with 21 additions and 0 deletions
|
@ -848,6 +848,10 @@ public:
|
|||
null_value= args[0]->null_value;
|
||||
return value;
|
||||
}
|
||||
void fix_length_and_dec_double()
|
||||
{
|
||||
fix_char_length(MAX_BIGINT_WIDTH);
|
||||
}
|
||||
void fix_length_and_dec_generic()
|
||||
{
|
||||
uint32 char_length= MY_MIN(args[0]->max_char_length(),
|
||||
|
|
|
@ -4214,6 +4214,21 @@ bool Type_handler_string_result::
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Type_handler_real_result::
|
||||
Item_func_signed_fix_length_and_dec(Item_func_signed *item) const
|
||||
{
|
||||
item->fix_length_and_dec_double();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Type_handler_real_result::
|
||||
Item_func_unsigned_fix_length_and_dec(Item_func_unsigned *item) const
|
||||
{
|
||||
item->fix_length_and_dec_double();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Type_handler::
|
||||
Item_double_typecast_fix_length_and_dec(Item_double_typecast *item) const
|
||||
|
|
|
@ -1299,6 +1299,8 @@ public:
|
|||
bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const;
|
||||
bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const;
|
||||
bool Item_sum_variance_fix_length_and_dec(Item_sum_variance *) const;
|
||||
bool Item_func_signed_fix_length_and_dec(Item_func_signed *item) const;
|
||||
bool Item_func_unsigned_fix_length_and_dec(Item_func_unsigned *item) const;
|
||||
longlong Item_val_int_signed_typecast(Item *item) const;
|
||||
longlong Item_val_int_unsigned_typecast(Item *item) const;
|
||||
String *Item_func_hex_val_str_ascii(Item_func_hex *item, String *str) const;
|
||||
|
|
Loading…
Reference in a new issue