diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2011-10-27 00:23:48 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2011-10-27 00:23:48 +0400 |
commit | 53b11ef2f47ed976c6fc2e6d16928f8684029ee2 (patch) | |
tree | df5eb5e242225e9332c7f2d99225a3a8c387dd15 /sql/item_cmpfunc.cc | |
parent | 08115a80e5c5c150ff39813e61f57619a323fa53 (diff) | |
download | mariadb-git-53b11ef2f47ed976c6fc2e6d16928f8684029ee2.tar.gz |
Post-merge fixes: Fix problems in table_elim.test and enable it.
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r-- | sql/item_cmpfunc.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 3e7cc24dfd8..c0d3b14b71b 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1424,7 +1424,11 @@ bool Item_in_optimizer::fix_left(THD *thd, Item **ref) cache->setup(args[0]); if (cache->cols() == 1) { - if ((used_tables_cache= args[0]->used_tables())) + /* + Note: there can be cases when used_tables()==0 && !const_item(). See + Item_sum::update_used_tables for details. + */ + if ((used_tables_cache= args[0]->used_tables()) || !args[0]->const_item()) cache->set_used_tables(OUTER_REF_TABLE_BIT); else cache->set_used_tables(0); @@ -1434,7 +1438,8 @@ bool Item_in_optimizer::fix_left(THD *thd, Item **ref) uint n= cache->cols(); for (uint i= 0; i < n; i++) { - if (args[0]->element_index(i)->used_tables()) + Item *element=args[0]->element_index(i); + if (element->used_tables() || !element->const_item()) ((Item_cache *)cache->element_index(i))->set_used_tables(OUTER_REF_TABLE_BIT); else ((Item_cache *)cache->element_index(i))->set_used_tables(0); |