summaryrefslogtreecommitdiff
path: root/sql/opt_sum.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2011-12-27 19:13:53 -0800
committerIgor Babaev <igor@askmonty.org>2011-12-27 19:13:53 -0800
commit31805e621495e33d4dcf4e4b2180d42367f90894 (patch)
tree5cfb63dd4e1e319ec7dddac026d63e383958a321 /sql/opt_sum.cc
parentc9259f166bfcc757338c957f806e3d18637da17a (diff)
downloadmariadb-git-31805e621495e33d4dcf4e4b2180d42367f90894.tar.gz
Fixed LP bug #879860.
The MIN/MAX optimization cannot be applied to a subquery if its WHERE clause contains a conjunctive condition depending on an outer reference.
Diffstat (limited to 'sql/opt_sum.cc')
-rw-r--r--sql/opt_sum.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index 27a848cb0ec..cd6e7a4ffaa 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -608,6 +608,10 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo,
if (!cond)
DBUG_RETURN(TRUE);
Field *field= field_part->field;
+ if (cond->used_tables() & OUTER_REF_TABLE_BIT)
+ {
+ DBUG_RETURN(FALSE);
+ }
if (!(cond->used_tables() & field->table->map) &&
test(cond->used_tables() & ~PSEUDO_TABLE_BITS))
{