summaryrefslogtreecommitdiff
path: root/sql/item_sum.cc
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2011-10-27 00:23:48 +0400
committerSergey Petrunya <psergey@askmonty.org>2011-10-27 00:23:48 +0400
commit53b11ef2f47ed976c6fc2e6d16928f8684029ee2 (patch)
treedf5eb5e242225e9332c7f2d99225a3a8c387dd15 /sql/item_sum.cc
parent08115a80e5c5c150ff39813e61f57619a323fa53 (diff)
downloadmariadb-git-53b11ef2f47ed976c6fc2e6d16928f8684029ee2.tar.gz
Post-merge fixes: Fix problems in table_elim.test and enable it.
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r--sql/item_sum.cc19
1 files changed, 14 insertions, 5 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index d60eb1415b9..0b8ae2d1d54 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -550,11 +550,20 @@ void Item_sum::update_used_tables ()
args[i]->update_used_tables();
used_tables_cache|= args[i]->used_tables();
}
-
- used_tables_cache&= PSEUDO_TABLE_BITS;
-
- /* the aggregate function is aggregated into its local context */
- used_tables_cache |= (1 << aggr_sel->join->table_count) - 1;
+ /*
+ MariaDB: don't run the following {
+
+ used_tables_cache&= PSEUDO_TABLE_BITS;
+
+ // the aggregate function is aggregated into its local context
+ used_tables_cache |= (1 << aggr_sel->join->table_count) - 1;
+
+ } because if we do it, table elimination will assume that
+ - constructs like "COUNT(*)" use columns from all tables
+ - so, it is not possible to eliminate any table
+ our solution for COUNT(*) is that it has
+ item->used_tables() == 0 && !item->const_item()
+ */
}
}