diff options
author | Sergei Golubchik <serg@mariadb.org> | 2015-11-19 15:52:14 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2015-11-19 15:52:14 +0100 |
commit | beded7d9c9592ca8fdfc367f7c64f89c35995c44 (patch) | |
tree | a215a54ed5043bb17fe7d69a69439e05b21682d5 /sql/opt_sum.cc | |
parent | af71da5d2f90c82b2357e808640003907c488bc2 (diff) | |
parent | 2553f143fdeb9068eb02a8fda58750c24071f5ef (diff) | |
download | mariadb-git-beded7d9c9592ca8fdfc367f7c64f89c35995c44.tar.gz |
Merge branch '10.0' into 10.1
Diffstat (limited to 'sql/opt_sum.cc')
-rw-r--r-- | sql/opt_sum.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index e8cff9e69ab..f36887eb137 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -341,7 +341,8 @@ int opt_sum_query(THD *thd, there are no outer joins. */ if (!conds && !((Item_sum_count*) item)->get_arg(0)->maybe_null && - !outer_tables && maybe_exact_count) + !outer_tables && maybe_exact_count && + ((item->used_tables() & OUTER_REF_TABLE_BIT) == 0)) { if (!is_exact_count) { @@ -369,7 +370,8 @@ int opt_sum_query(THD *thd, indexes to find the key. */ Item *expr=item_sum->get_arg(0); - if (expr->real_item()->type() == Item::FIELD_ITEM) + if (((expr->used_tables() & OUTER_REF_TABLE_BIT) == 0) && + expr->real_item()->type() == Item::FIELD_ITEM) { uchar key_buff[MAX_KEY_LENGTH]; TABLE_REF ref; |