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
@@ -1731,13 +1731,13 @@ class SQL_SELECT :public Sql_alloc {
|
||||
|
||||
/*
|
||||
RETURN
|
||||
0 if record must be skipped <-> (cond && cond->val_int() == 0)
|
||||
0 if record must be skipped <-> (cond && cond->val_bool() == false)
|
||||
-1 if error
|
||||
1 otherwise
|
||||
*/
|
||||
inline int skip_record(THD *thd)
|
||||
{
|
||||
int rc= MY_TEST(!cond || cond->val_int());
|
||||
int rc= MY_TEST(!cond || cond->val_bool());
|
||||
if (thd->is_error())
|
||||
rc= -1;
|
||||
return rc;
|
||||
|
Reference in New Issue
Block a user