1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Fixed bug#20825: rollup puts non-equal values together

Fix for bug 7894 replaces a field(s) in a non-aggregate function with a item
reference if such a field was specified in the GROUP BY clause in order to
get a correct result.
When ROLLUP is involved this lead to a wrong result due to value of a such
field is got through a copy function and copying happens after the function
evaluation.
Such replacement isn't needed if grouping is also done by such a function.

The change_group_ref() function now isn't called for a function present in
the group list.
This commit is contained in:
evgen@moonbone.local
2006-09-29 20:02:53 +04:00
parent 55cc4fd5c6
commit 0c9f941bb2
3 changed files with 30 additions and 1 deletions

View File

@ -9706,12 +9706,17 @@ bool JOIN::rollup_init()
while ((item= it++))
{
ORDER *group_tmp;
bool found_in_group= 0;
for (group_tmp= group_list; group_tmp; group_tmp= group_tmp->next)
{
if (*group_tmp->item == item)
{
item->maybe_null= 1;
found_in_group= 1;
}
}
if (item->type() == Item::FUNC_ITEM)
if (item->type() == Item::FUNC_ITEM && !found_in_group)
{
bool changed= FALSE;
if (change_group_ref(thd, (Item_func *) item, group_list, &changed))