mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-15579 Crash in Item_field::used_tables() called by
Item::derived_field_transformer_for_having The crash occurred due to an inappropriate handling of multiple equalities when pushing conditions into materialized views/derived tables. If equalities extracted from a multiple equality can be pushed into a materialized view/derived table they should be plainly conjuncted with other pushed predicates rather than form a separate AND sub-formula.
This commit is contained in:
@@ -8207,6 +8207,7 @@ Item* TABLE_LIST::build_pushable_cond_for_table(THD *thd, Item *cond)
|
||||
return 0;
|
||||
List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
|
||||
Item *item;
|
||||
bool is_fix_needed= false;
|
||||
while ((item=li++))
|
||||
{
|
||||
if (item->get_extraction_flag() == NO_EXTRACTION_FL)
|
||||
@@ -8220,8 +8221,16 @@ Item* TABLE_LIST::build_pushable_cond_for_table(THD *thd, Item *cond)
|
||||
return 0;
|
||||
if (!fix)
|
||||
continue;
|
||||
|
||||
if (fix->type() == Item::COND_ITEM &&
|
||||
((Item_cond*) fix)->functype() == Item_func::COND_AND_FUNC)
|
||||
is_fix_needed= true;
|
||||
|
||||
new_cond->argument_list()->push_back(fix, thd->mem_root);
|
||||
}
|
||||
if (is_fix_needed)
|
||||
new_cond->fix_fields(thd, 0);
|
||||
|
||||
switch (new_cond->argument_list()->elements)
|
||||
{
|
||||
case 0:
|
||||
|
Reference in New Issue
Block a user