diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2015-10-22 13:57:44 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2015-10-28 09:34:05 +0100 |
commit | ce1b450ab1b75b3c469b8c490e40226973fdad17 (patch) | |
tree | ba4a4db4b94eb4cfdd1ca48f4924596469cd5a2c /sql/opt_sum.cc | |
parent | e1ed331ceabbf51b3409529ec78039c42324e1b0 (diff) | |
download | mariadb-git-ce1b450ab1b75b3c469b8c490e40226973fdad17.tar.gz |
MDEV-7930 Assertion `table_share->tmp_table != NO_TMP_TABLE || m_lock_type != 2' failed in handler::ha_index_read_map
In optimizing aggregate function do not try to touch tables from outer
query.
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 fc3ce09dd8e..1ff1f4a6449 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; |