1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge 10.5 into 10.6

This commit is contained in:
Marko Mäkelä
2024-03-12 09:19:57 +02:00
80 changed files with 2667 additions and 617 deletions

View File

@@ -41,6 +41,7 @@ Named_type_handler<Type_handler_bool> type_handler_bool("boolean");
Named_type_handler<Type_handler_tiny> type_handler_stiny("tinyint");
Named_type_handler<Type_handler_short> type_handler_sshort("smallint");
Named_type_handler<Type_handler_long> type_handler_slong("int");
Named_type_handler<Type_handler_long_ge0> type_handler_slong_ge0("int");
Named_type_handler<Type_handler_int24> type_handler_sint24("mediumint");
Named_type_handler<Type_handler_longlong> type_handler_slonglong("bigint");
Named_type_handler<Type_handler_utiny> type_handler_utiny("tiny unsigned");
@@ -4631,6 +4632,10 @@ bool Type_handler_general_purpose_int::
bool unsigned_flag= items[0]->unsigned_flag;
for (uint i= 1; i < nitems; i++)
{
/*
TODO: avoid creating DECIMAL for a mix of ulong and slong_ge0.
It's too late for 10.5. Let's do it in a higher version.
*/
if (unsigned_flag != items[i]->unsigned_flag)
{
// Convert a mixture of signed and unsigned int to decimal
@@ -4640,6 +4645,21 @@ bool Type_handler_general_purpose_int::
}
}
func->aggregate_attributes_int(items, nitems);
for (uint i= 0; i < nitems; i++)
{
if (items[i]->type_handler() == &type_handler_slong_ge0)
{
/*
A slong_ge0 argument found.
We need to add an extra character for the sign.
TODO: rewrite aggregate_attributes_int() to find
the maximum decimal_precision() instead of the maximum max_length.
This change is too late for 10.5, so let's do it in a higher version.
*/
uint digits_and_sign= items[i]->decimal_precision() + 1;
set_if_bigger(func->max_length, digits_and_sign);
}
}
handler->set_handler(func->unsigned_flag ?
handler->type_handler()->type_handler_unsigned() :
handler->type_handler()->type_handler_signed());
@@ -4935,6 +4955,13 @@ bool Type_handler_real_result::
/*************************************************************************/
bool Type_handler_long_ge0::
Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const
{
return func->fix_length_and_dec_sint_ge0();
}
bool Type_handler_int_result::
Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const
{
@@ -6377,6 +6404,14 @@ bool Type_handler_int_result::
}
bool Type_handler_long_ge0::
Item_func_round_fix_length_and_dec(Item_func_round *item) const
{
item->fix_arg_slong_ge0();
return false;
}
bool Type_handler_year::
Item_func_round_fix_length_and_dec(Item_func_round *item) const
{
@@ -6598,6 +6633,14 @@ bool Type_handler_int_result::
}
bool Type_handler_long_ge0::
Item_func_abs_fix_length_and_dec(Item_func_abs *item) const
{
item->fix_length_and_dec_sint_ge0();
return false;
}
bool Type_handler_real_result::
Item_func_abs_fix_length_and_dec(Item_func_abs *item) const
{
@@ -6708,6 +6751,22 @@ bool Type_handler::
}
bool Type_handler_long_ge0::
Item_func_signed_fix_length_and_dec(Item_func_signed *item) const
{
item->fix_length_and_dec_sint_ge0();
return false;
}
bool Type_handler_long_ge0::
Item_func_unsigned_fix_length_and_dec(Item_func_unsigned *item) const
{
item->fix_length_and_dec_sint_ge0();
return false;
}
bool Type_handler_string_result::
Item_func_signed_fix_length_and_dec(Item_func_signed *item) const
{
@@ -7193,6 +7252,18 @@ decimal_digits_t Type_handler_int_result::Item_decimal_precision(const Item *ite
return (decimal_digits_t) MY_MIN(prec, DECIMAL_MAX_PRECISION);
}
decimal_digits_t Type_handler_long_ge0::Item_decimal_precision(const Item *item) const
{
DBUG_ASSERT(item->max_length);
DBUG_ASSERT(!item->decimals);
/*
Unlinke in Type_handler_long, Type_handler_long_ge does
not reserve one character for the sign. All max_length
characters are digits.
*/
return MY_MIN(item->max_length, DECIMAL_MAX_PRECISION);
}
decimal_digits_t Type_handler_time_common::Item_decimal_precision(const Item *item) const
{
return (decimal_digits_t) (7 + MY_MIN(item->decimals, TIME_SECOND_PART_DIGITS));
@@ -8198,6 +8269,26 @@ Field *Type_handler_long::
}
Field *Type_handler_long_ge0::
make_table_field_from_def(TABLE_SHARE *share, MEM_ROOT *mem_root,
const LEX_CSTRING *name,
const Record_addr &rec, const Bit_addr &bit,
const Column_definition_attributes *attr,
uint32 flags) const
{
/*
We're converting signed long_ge0 to signed long.
So add one character for the sign.
*/
return new (mem_root)
Field_long(rec.ptr(), (uint32) attr->length + 1/*sign*/,
rec.null_ptr(), rec.null_bit(),
attr->unireg_check, name,
f_is_zerofill(attr->pack_flag) != 0,
f_is_dec(attr->pack_flag) == 0);
}
Field *Type_handler_longlong::
make_table_field_from_def(TABLE_SHARE *share, MEM_ROOT *mem_root,
const LEX_CSTRING *name,