MDEV-18383: Missing rows with pushdown condition defined with IF-function

using Item_cond

This bug is similar to the bug MDEV-16765.
It appears because of the wrong pushdown into HAVING clause while this
pushdown shouldn't be made at all.
This happens because function that checks if Item_cond can be pushed
always returns that it can be pushed.

To fix it new method Item_cond::excl_dep_on_table() was added.
This commit is contained in:
Galina Shalygina 2019-02-23 22:16:33 +03:00
commit 2faefe5f7f
4 changed files with 61 additions and 0 deletions

View file

@ -4994,6 +4994,23 @@ Item *Item_cond::build_clone(THD *thd, MEM_ROOT *mem_root)
}
bool Item_cond::excl_dep_on_table(table_map tab_map)
{
if (used_tables() & OUTER_REF_TABLE_BIT)
return false;
if (!(used_tables() & ~tab_map))
return true;
List_iterator_fast<Item> li(list);
Item *item;
while ((item= li++))
{
if (!item->excl_dep_on_table(tab_map))
return false;
}
return true;
}
bool Item_cond::excl_dep_on_grouping_fields(st_select_lex *sel)
{
List_iterator_fast<Item> li(list);