summaryrefslogtreecommitdiff
path: root/sql/opt_sum.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2012-02-22 13:04:58 -0800
committerIgor Babaev <igor@askmonty.org>2012-02-22 13:04:58 -0800
commit90c26209ba52cb7df75cf3464a7dde8bf47531b9 (patch)
treebc8b3f5226fdb97a2fc78cd1809d322d3f59cc82 /sql/opt_sum.cc
parent56e1a6936bcdebb8fe672ea040235bfa9867e10e (diff)
parent567d871ff0c9cbdcaa4f9daa6810760edc901e14 (diff)
downloadmariadb-git-90c26209ba52cb7df75cf3464a7dde8bf47531b9.tar.gz
Merge.
Diffstat (limited to 'sql/opt_sum.cc')
-rw-r--r--sql/opt_sum.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index 60830d8be69..9fece2dadb6 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -623,7 +623,12 @@ 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() & field->table->map))
+ 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))
{
/* Condition doesn't restrict the used table */
DBUG_RETURN(!cond->const_item());