summaryrefslogtreecommitdiff
path: root/sql/opt_sum.cc
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2011-12-08 02:12:48 +0400
committerSergey Petrunya <psergey@askmonty.org>2011-12-08 02:12:48 +0400
commit49ecc880699b9627a1fbec8fa5c4d025ccb9a7cf (patch)
tree1dba8b1a26faac1dc90ff8d20019dc7871b57761 /sql/opt_sum.cc
parent7414a0b6d6307f8c2644660cf2f8daf986c25970 (diff)
downloadmariadb-git-49ecc880699b9627a1fbec8fa5c4d025ccb9a7cf.tar.gz
BUG#901032: Wrong result for MIN/MAX on an indexed column with materialization and semijoin
- opt_sum_query() should not assume that join tables from sj-materialization have known numbers of rows.
Diffstat (limited to 'sql/opt_sum.cc')
-rw-r--r--sql/opt_sum.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index 7b4c48497fa..6e293e8b686 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -299,7 +299,8 @@ int opt_sum_query(THD *thd,
is_exact_count= FALSE;
count= 1; // ensure count != 0
}
- else if (tl->is_materialized_derived())
+ else if (tl->is_materialized_derived() ||
+ tl->jtbm_subselect)
{
/*
Can't remove a derived table as it's number of rows is just an