From ebe5a38e16f0042cd18721bf8043f6ca753ad2e5 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Wed, 16 Nov 2016 15:06:19 -0800 Subject: [PATCH] Correction for the patch for mdev-11102. --- sql/sql_select.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 987b3522cdd..1114e1e1f1d 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1281,11 +1281,17 @@ JOIN::optimize_inner() Do not push conditions from where into materialized inner tables of outer joins: this is not valid. */ - if (tbl->is_materialized_derived() && - !tbl->is_inner_table_of_outer_join()) + 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); }