1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

fix for bug #11904 (select statement, cursor, grouping wrong results)

This commit is contained in:
andrey@lmy004.
2005-08-26 09:45:30 +02:00
parent d4a25c1b36
commit 7b1b3997a8
2 changed files with 87 additions and 2 deletions

View File

@ -10256,6 +10256,7 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
bool end_of_records)
{
int idx= -1;
enum_nested_loop_state ok_code= NESTED_LOOP_OK;
DBUG_ENTER("end_send_group");
if (!join->first_record || end_of_records ||
@ -10320,7 +10321,11 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
There is a server side cursor and all rows
for this fetch request are sent.
*/
DBUG_RETURN(NESTED_LOOP_CURSOR_LIMIT);
/*
Preventing code duplication. When finished with the group reset
the group functions and copy_fields. We fall through. bug #11904
*/
ok_code= NESTED_LOOP_CURSOR_LIMIT;
}
}
}
@ -10333,12 +10338,16 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
}
if (idx < (int) join->send_group_parts)
{
/*
This branch is executed also for cursors which have finished their
fetch limit - the reason for ok_code.
*/
copy_fields(&join->tmp_table_param);
if (init_sum_functions(join->sum_funcs, join->sum_funcs_end[idx+1]))
DBUG_RETURN(NESTED_LOOP_ERROR);
if (join->procedure)
join->procedure->add();
DBUG_RETURN(NESTED_LOOP_OK);
DBUG_RETURN(ok_code);
}
}
if (update_sum_func(join->sum_funcs))