diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2011-11-01 12:36:43 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2011-11-01 12:36:43 +0400 |
commit | f2b6f4e3df2a41e15b155d6019dfa81982181e91 (patch) | |
tree | 4c665d4ef4a14df2401c16c5684304ae27aa3149 /sql | |
parent | aa327cdd484809f2603004a8690bbb2d105deb5e (diff) | |
download | mariadb-git-f2b6f4e3df2a41e15b155d6019dfa81982181e91.tar.gz |
BUG#884184: Wrong result with RIGHT JOIN + derived_merge
- Make eliminate_tables_for_list() take into account that it is not possible
to eliminate a table if it is used in the upper-side ON expressions. Example:
xxx JOIN (t1 LEFT JOIN t2 ON cond ) ON func(t2.columns)
Here it would eliminate t2 which is not possible because of use of t2.columns.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/opt_table_elimination.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sql/opt_table_elimination.cc b/sql/opt_table_elimination.cc index fdf818abb8e..65a7d662425 100644 --- a/sql/opt_table_elimination.cc +++ b/sql/opt_table_elimination.cc @@ -695,6 +695,8 @@ eliminate_tables_for_list(JOIN *join, List<TABLE_LIST> *join_list, { table_map outside_used_tables= tables_used_elsewhere | tables_used_on_left; + if (on_expr) + outside_used_tables |= on_expr->used_tables(); if (tbl->nested_join) { /* This is "... LEFT JOIN (join_nest) ON cond" */ |