summaryrefslogtreecommitdiff
path: root/sql/opt_sum.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/opt_sum.cc')
-rw-r--r--sql/opt_sum.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index ed8e694dcb7..8a5a5875d47 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -96,8 +96,14 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
*/
for (TABLE_LIST *tl= tables; tl; tl= tl->next_leaf)
{
+ TABLE_LIST *embedded;
+ for (embedded= tl ; embedded; embedded= embedded->embedding)
+ {
+ if (embedded->on_expr)
+ break;
+ }
+ if (embedded)
/* Don't replace expression on a table that is part of an outer join */
- if (tl->on_expr)
{
outer_tables|= tl->table->map;