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.
This commit is contained in:
Sergey Petrunya 2011-12-08 02:12:48 +04:00
commit 49ecc88069
4 changed files with 41 additions and 1 deletions

View file

@ -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