summaryrefslogtreecommitdiff
path: root/sql/opt_subselect.cc
diff options
context:
space:
mode:
authorunknown <timour@askmonty.org>2012-06-06 16:19:48 +0300
committerunknown <timour@askmonty.org>2012-06-06 16:19:48 +0300
commit8efc63ba5d32b77501226921ee503b9ae513a365 (patch)
treef87c5142ed7dc5ff72555b22ad19632fea527e10 /sql/opt_subselect.cc
parent7eaf0975ac4e1752399fdc06209739171350ccf4 (diff)
parentf1ab00891ad050711557c6cdc62b17fff896aed9 (diff)
downloadmariadb-git-8efc63ba5d32b77501226921ee503b9ae513a365.tar.gz
Merge
Diffstat (limited to 'sql/opt_subselect.cc')
-rw-r--r--sql/opt_subselect.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index bab061a2ac7..a5a68d0d306 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -5455,11 +5455,17 @@ bool JOIN::choose_subquery_plan(table_map join_tables)
if (in_subs->inject_in_to_exists_cond(this))
return TRUE;
/*
- It is IN->EXISTS transformation so we should mark subquery as
- dependent
+ If the injected predicate is correlated the IN->EXISTS transformation
+ make the subquery dependent.
*/
- in_subs->unit->uncacheable|= UNCACHEABLE_DEPENDENT_INJECTED;
- select_lex->uncacheable|= UNCACHEABLE_DEPENDENT_INJECTED;
+ if ((in_to_exists_where &&
+ in_to_exists_where->used_tables() & OUTER_REF_TABLE_BIT) ||
+ (in_to_exists_having &&
+ in_to_exists_having->used_tables() & OUTER_REF_TABLE_BIT))
+ {
+ in_subs->unit->uncacheable|= UNCACHEABLE_DEPENDENT_INJECTED;
+ select_lex->uncacheable|= UNCACHEABLE_DEPENDENT_INJECTED;
+ }
select_limit= 1;
}
else