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

Merge branch '10.5' into 10.6

This commit is contained in:
Oleksandr Byelkin
2023-11-08 15:57:05 +01:00
381 changed files with 10233 additions and 5782 deletions

View File

@@ -1823,6 +1823,7 @@ Type_handler::bit_and_int_mixture_handler(uint max_char_length)
Note, independently from "treat_bit_as_number":
- a single BIT argument gives BIT as a result
- two BIT couterparts give BIT as a result
- (BIT + explicit NULL) or (explicit NULL + BIT) give BIT
@details This function aggregates field types from the array of items.
Found type is supposed to be used later as the result field type
@@ -1854,8 +1855,11 @@ aggregate_for_result(const LEX_CSTRING &funcname, Item **items, uint nitems,
{
const Type_handler *cur= items[i]->type_handler();
set_if_bigger(max_display_length, items[i]->max_display_length());
if (treat_bit_as_number &&
((type_handler() == &type_handler_bit) ^ (cur == &type_handler_bit)))
uint bit_count= (type_handler() == &type_handler_bit) +
(cur == &type_handler_bit);
uint null_count= (type_handler() == &type_handler_null) +
(cur == &type_handler_null);
if (treat_bit_as_number && bit_count == 1 && null_count == 0)
{
bit_and_non_bit_mixture_found= true;
if (type_handler() == &type_handler_bit)
@@ -4578,12 +4582,39 @@ Type_handler_timestamp_common::create_item_copy(THD *thd, Item *item) const
/*************************************************************************/
/*
This method handles YEAR and BIT data types.
It does not switch the data type to DECIAMAL on a
unsigned_flag mistmatch. This important for combinations
like YEAR+NULL, BIT+NULL.
*/
bool Type_handler_int_result::
Item_hybrid_func_fix_attributes(THD *thd,
const LEX_CSTRING &name,
Type_handler_hybrid_field_type *handler,
Type_all_attributes *func,
Item **items, uint nitems) const
{
func->aggregate_attributes_int(items, nitems);
return false;
}
/*
This method handles general purpose integer data types
TINYINT, SHORTINT, MEDIUNINT, BIGINT.
It switches to DECIMAL in case if a mismatch in unsigned_flag found.
Note, we should fix this to ignore all items with
type_handler()==&type_handler_null.
It's too late for 10.4. Let's do it eventually in a higher version.
*/
bool Type_handler_general_purpose_int::
Item_hybrid_func_fix_attributes(THD *thd,
const LEX_CSTRING &name,
Type_handler_hybrid_field_type *handler,
Type_all_attributes *func,
Item **items, uint nitems) const
{
bool unsigned_flag= items[0]->unsigned_flag;
for (uint i= 1; i < nitems; i++)