diff options
author | Igor Babaev <igor@askmonty.org> | 2017-04-24 23:58:23 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2017-04-24 23:58:23 -0700 |
commit | 4beb7e5355f7bfbec8bfdb0f00b933fbf76dfa61 (patch) | |
tree | 9e09be59fc157c86129bce9ec893ab70fa080619 /sql | |
parent | 0906dc49e8c442ca00b8b7889ee09812040e5638 (diff) | |
download | mariadb-git-4beb7e5355f7bfbec8bfdb0f00b933fbf76dfa61.tar.gz |
Fixed the bug mdev-12373.
Condition pushdown into derived tables / views with side effects
is not allowed.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_func.cc | 3 | ||||
-rw-r--r-- | sql/sql_derived.cc | 3 | ||||
-rw-r--r-- | sql/table.h | 2 |
3 files changed, 8 insertions, 0 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index ed527cda218..903d792db75 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -4698,7 +4698,10 @@ bool Item_func_set_user_var::fix_fields(THD *thd, Item **ref) for (derived= unit->derived; derived; derived= derived->select_lex->master_unit()->derived) + { derived->set_materialized_derived(); + derived->prohibit_cond_pushdown= true; + } } return FALSE; diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index 90b6dad313a..916f7057607 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -1147,6 +1147,9 @@ bool pushdown_cond_for_derived(THD *thd, Item *cond, TABLE_LIST *derived) st_select_lex_unit *unit= derived->get_unit(); st_select_lex *sl= unit->first_select(); + if (derived->prohibit_cond_pushdown) + DBUG_RETURN(false); + /* Do not push conditions into constant derived */ if (unit->executed) DBUG_RETURN(false); diff --git a/sql/table.h b/sql/table.h index f9b6ac4ae22..22846e05bde 100644 --- a/sql/table.h +++ b/sql/table.h @@ -2148,6 +2148,8 @@ struct TABLE_LIST /* I_S: Flags to open_table (e.g. OPEN_TABLE_ONLY or OPEN_VIEW_ONLY) */ uint i_s_requested_object; + bool prohibit_cond_pushdown; + /* I_S: how to read the tables (SKIP_OPEN_TABLE/OPEN_FRM_ONLY/OPEN_FULL_TABLE) */ |