summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 1f79010e993..1114e1e1f1d 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1277,10 +1277,21 @@ JOIN::optimize_inner()
List_iterator_fast<TABLE_LIST> li(select_lex->leaf_tables);
while ((tbl= li++))
{
+ /*
+ Do not push conditions from where into materialized inner tables
+ of outer joins: this is not valid.
+ */
if (tbl->is_materialized_derived())
{
- if (pushdown_cond_for_derived(thd, conds, tbl))
- DBUG_RETURN(1);
+ /*
+ Do not push conditions from where into materialized inner tables
+ of outer joins: this is not valid.
+ */
+ if (!tbl->is_inner_table_of_outer_join())
+ {
+ if (pushdown_cond_for_derived(thd, conds, tbl))
+ DBUG_RETURN(1);
+ }
if (mysql_handle_single_derived(thd->lex, tbl, DT_OPTIMIZE))
DBUG_RETURN(1);
}