diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2012-02-14 13:58:57 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2012-02-14 13:58:57 +0400 |
commit | c9355dc279ac30cc41ff076d20414fd59c36091d (patch) | |
tree | a54a3d4a249e6c7ed0992baf5b0e2f58ecf70b1a /sql/sql_select.cc | |
parent | 3efc8d016f1e1fbc854a4698e1d06aba5fa2ec15 (diff) | |
download | mariadb-git-c9355dc279ac30cc41ff076d20414fd59c36091d.tar.gz |
BUG#928048: Query containing IN subquery with OR in the where clause returns a wrong result
- Make equality propagation work correctly when done inside the OR branches
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 05fba45792b..292ed9439e4 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -11490,7 +11490,7 @@ Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels, } /* - Check if "item_field=head" equality is already guaranteed to be true + Check if "field_item=head" equality is already guaranteed to be true on upper AND-levels. */ if (upper) @@ -11502,7 +11502,8 @@ Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels, Item_equal_fields_iterator li(*item_equal); while ((item= li++) != field_item) { - if (item->find_item_equal(upper_levels) == upper) + if (embedding_sjm(item) == field_sjm && + item->find_item_equal(upper_levels) == upper) break; } } @@ -11646,7 +11647,7 @@ static COND* substitute_for_best_equal_field(JOIN_TAB *context_tab, if (and_level) { cond_equal= &((Item_cond_and *) cond)->cond_equal; - cond_list->disjoin((List<Item> *) &cond_equal->current_level); + cond_list->disjoin((List<Item> *) &cond_equal->current_level);/* remove Item_equal objects from the AND. */ List_iterator_fast<Item_equal> it(cond_equal->current_level); while ((item_equal= it++)) |