mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-34123 CONCAT Function Returns Unexpected Empty Set in Query
Search conditions were evaluated using val_int(), which was wrong. Fixing the code to use val_bool() instead. Details: - Adding a new item_base_t::IS_COND flag which marks Items used as <search condition> in WHERE, HAVING, JOIN ON, CASE WHEN clauses. The flag is at the parse time. These expressions must be evaluated using val_bool() rather than val_int(). Note, the optimizer creates more Items which are used as search conditions. Most of these items are not marked with IS_COND yet. This is OK for now, but eventually these Items can also be fixed to have the flag. - Adding a method Item::is_cond() which tests if the Item has the IS_COND flag. - Implementing Item_cache_bool. It evaluates the cached expression using val_bool() rather than val_int(). Overriding Type_handler_bool::Item_get_cache() to create Item_cache_bool. - Implementing Item::save_bool_in_field(). It uses val_bool() rather than val_int() to evaluate the expression. - Implementing Type_handler_bool::Item_save_in_field() using Item::save_bool_in_field(). - Fixing all Item_bool_func descendants to implement a virtual val_bool() rather than a virtual val_int(). - To find places where val_int() should be fixed to val_bool(), a few DBUG_ASSERT(!is_cond()) where added into val_int() implementations of selected (most frequent) classes: Item_field Item_str_func Item_datefunc Item_timefunc Item_datetimefunc Item_cache_bool Item_bool_func Item_func_hybrid_field_type Item_basic_constant descendants - Fixing all places where DBUG_ASSERT() happened during an "mtr" run to use val_bool() instead of val_int().
This commit is contained in:
committed by
Oleksandr Byelkin
parent
6f6c1911dc
commit
a931da82fa
@@ -3832,7 +3832,7 @@ static bool show_status_array(THD *thd, const char *wild,
|
||||
if ((wild_checked ||
|
||||
!(wild && wild[0] && wild_case_compare(system_charset_info,
|
||||
name_buffer, wild))) &&
|
||||
(!cond || cond->val_int()))
|
||||
(!cond || cond->val_bool()))
|
||||
{
|
||||
const char *pos; // We assign a lot of const's
|
||||
size_t length;
|
||||
@@ -5315,7 +5315,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
|
||||
table->field[schema_table->idx_field2]->
|
||||
store(table_name->str, table_name->length, system_charset_info);
|
||||
|
||||
if (!partial_cond || partial_cond->val_int())
|
||||
if (!partial_cond || partial_cond->val_bool())
|
||||
{
|
||||
/*
|
||||
If table is I_S.tables and open_table_method is 0 (eg SKIP_OPEN)
|
||||
@@ -8148,7 +8148,7 @@ int fill_status(THD *thd, TABLE_LIST *tables, COND *cond)
|
||||
COND *partial_cond= make_cond_for_info_schema(thd, cond, tables);
|
||||
// Evaluate and cache const subqueries now, before the mutex.
|
||||
if (partial_cond)
|
||||
partial_cond->val_int();
|
||||
partial_cond->val_bool();
|
||||
|
||||
tmp.local_memory_used= 0; // meaning tmp was not populated yet
|
||||
|
||||
|
Reference in New Issue
Block a user