diff options
author | Galina Shalygina <galina.shalygina@mariadb.com> | 2018-08-20 17:42:49 +0300 |
---|---|---|
committer | Galina Shalygina <galina.shalygina@mariadb.com> | 2018-08-20 17:42:49 +0300 |
commit | 0de3c423cc51d362c3a9b4dc8fa90d549ce0754e (patch) | |
tree | 58beb48e0a76f5b35bbf78bdc1712fb948f26dfb /sql/item_cmpfunc.cc | |
parent | 862a97749d5a36218ba4d55c26eef30cd7b2e3cb (diff) | |
download | mariadb-git-0de3c423cc51d362c3a9b4dc8fa90d549ce0754e.tar.gz |
MDEV-16765: Missing rows with pushdown condition defined with CASE using Item_cond
The bug appears because of the wrong pushdown into the WHERE clause of the
materialized derived table/view work. For the excl_dep_on_grouping_fields()
method that checks if the condition can be pushed into the WHERE clause
the case when Item_cond is used is missing. For Item_cond elements this
method always returns positive result (that condition can be pushed).
So this condition is pushed even if is shouldn't be pushed.
To fix it new Item_cond::excl_dep_on_grouping_fields() method is added.
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r-- | sql/item_cmpfunc.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index f176a0a8193..6834820c0b5 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -4970,6 +4970,19 @@ Item *Item_cond::build_clone(THD *thd, MEM_ROOT *mem_root) } +bool Item_cond::excl_dep_on_grouping_fields(st_select_lex *sel) +{ + List_iterator_fast<Item> li(list); + Item *item; + while ((item= li++)) + { + if (!item->excl_dep_on_grouping_fields(sel)) + return false; + } + return true; +} + + void Item_cond_and::mark_as_condition_AND_part(TABLE_LIST *embedding) { List_iterator<Item> li(list); |