1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Fix bug#12887 Distinct is not always applied after rollup

For queries with GROUP BY and without hidden GROUP BY fields DISTINCT is
optimized away becuase such queries produce result set without duplicates.
But ROLLUP can add rows which may be same to some rows and this fact was
ignored.

Added check so if ROLLUP is present DISTINCT can't be optimized away.
This commit is contained in:
evgen@moonbone.local
2005-09-15 21:34:11 +04:00
parent cb4f132075
commit 1685040e2b
3 changed files with 22 additions and 1 deletions

View File

@ -618,7 +618,7 @@ JOIN::optimize()
}
if (group_list || tmp_table_param.sum_func_count)
{
if (! hidden_group_fields)
if (! hidden_group_fields && rollup.state == ROLLUP::STATE_NONE)
select_distinct=0;
}
else if (select_distinct && tables - const_tables == 1)