summaryrefslogtreecommitdiff
path: root/sql/item_subselect.h
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2017-05-09 00:41:45 -0700
committerIgor Babaev <igor@askmonty.org>2017-05-09 15:09:15 -0700
commit6b97fe067db1b1d8e8dee56508e6d78a36e92481 (patch)
treeefc467cbd8d37c47684aaa544338bb5aa5fe621d /sql/item_subselect.h
parent15f9931f6d2b0eb4006fdc42072c2905fd67c1aa (diff)
downloadmariadb-git-6b97fe067db1b1d8e8dee56508e6d78a36e92481.tar.gz
Fixed the bugs mdev-12670 and mdev-12675.
The code that blocked conversion of a IN subselect pedicate to a semi-join if it occurred in the ON expression of an outer join did not do it correctly. As a result, the conversion was blocked for IN subselect predicates encountered in ON expressions of INNER joins or in WHERE conditions of mergeable views / derived tables. This patch fixes this problem.
Diffstat (limited to 'sql/item_subselect.h')
-rw-r--r--sql/item_subselect.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 2f166c83e8f..75822ff8c6b 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -466,6 +466,8 @@ public:
NULL - for all other locations
*/
TABLE_LIST *emb_on_expr_nest;
+ /* May be TRUE only for the candidates to semi-join conversion */
+ bool do_not_convert_to_sj;
/*
Types of left_expr and subquery's select list allow to perform subquery
materialization. Currently, we set this to FALSE when it as well could
@@ -554,9 +556,9 @@ public:
Item_in_subselect()
:Item_exists_subselect(), left_expr_cache(0), first_execution(TRUE),
abort_on_null(0), in_strategy(SUBS_NOT_TRANSFORMED), optimizer(0),
- pushed_cond_guards(NULL), func(NULL), emb_on_expr_nest(NULL),
- is_jtbm_merged(FALSE), is_jtbm_const_tab(FALSE),
- upper_item(0)
+ pushed_cond_guards(NULL), func(NULL), emb_on_expr_nest(NULL),
+ do_not_convert_to_sj(FALSE), is_jtbm_merged(FALSE),
+ is_jtbm_const_tab(FALSE), upper_item(0)
{}
void cleanup();
subs_type substype() { return IN_SUBS; }
@@ -617,6 +619,8 @@ public:
emb_on_expr_nest= embedding;
}
+ void block_conversion_to_sj () { do_not_convert_to_sj= TRUE; }
+
bool test_strategy(uchar strategy)
{ return test(in_strategy & strategy); }