diff options
author | unknown <sanja@montyprogram.com> | 2013-11-11 22:47:04 +0200 |
---|---|---|
committer | unknown <sanja@montyprogram.com> | 2013-11-11 22:47:04 +0200 |
commit | 3a75900b91ffb4d49396d8f83e0b55b392e83a2a (patch) | |
tree | e21a66a326a380ae8d56859ed4f06a16fce20d92 /sql/opt_subselect.cc | |
parent | 8f0be1ad7c2f13a7fd96889bde3402e9a723fc33 (diff) | |
parent | dfed447888e1ab71ec0c80b61459bde6ee6eaf66 (diff) | |
download | mariadb-git-3a75900b91ffb4d49396d8f83e0b55b392e83a2a.tar.gz |
merge 5.5->10.0-base
Diffstat (limited to 'sql/opt_subselect.cc')
-rw-r--r-- | sql/opt_subselect.cc | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index f218e4c35f2..de5448ace63 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -1272,11 +1272,11 @@ void get_delayed_table_estimates(TABLE *table, @brief Replaces an expression destructively inside the expression tree of the WHERE clase. - @note Because of current requirements for semijoin flattening, we do not - need to recurse here, hence this function will only examine the top-level - AND conditions. (see JOIN::prepare, comment starting with "Check if the - subquery predicate can be executed via materialization". - + @note We substitute AND/OR structure because it was copied by + copy_andor_structure and some changes could be done in the copy but + should be left permanent, also there could be several layers of AND over + AND and OR over OR because ::fix_field() possibly is not called. + @param join The top-level query. @param old_cond The expression to be replaced. @param new_cond The expression to be substituted. @@ -1304,13 +1304,20 @@ static bool replace_where_subcondition(JOIN *join, Item **expr, Item *item; while ((item= li++)) { - if (item == old_cond) + if (item == old_cond) { li.replace(new_cond); if (do_fix_fields) new_cond->fix_fields(join->thd, li.ref()); return FALSE; } + else if (item->type() == Item::COND_ITEM) + { + DBUG_ASSERT(!(*expr)->fixed); + replace_where_subcondition(join, li.ref(), + old_cond, new_cond, + do_fix_fields); + } } } /* |