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

Merge moonbone.local:/work/27219-5.0-opt-mysql

into  moonbone.local:/work/27219-bug-5.1
This commit is contained in:
evgen@moonbone.local
2008-03-28 18:09:14 +03:00
10 changed files with 395 additions and 35 deletions

View File

@ -585,37 +585,13 @@ JOIN::prepare(Item ***rref_pointer_array,
/*
Check if there are references to un-aggregated columns when computing
aggregate functions with implicit grouping (there is no GROUP BY).
TODO: Add check of calculation of GROUP functions and fields:
SELECT COUNT(*)+table.col1 from table1;
*/
if (thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY)
if (thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY && !group_list &&
select_lex->full_group_by_flag == (NON_AGG_FIELD_USED | SUM_FUNC_USED))
{
if (!group_list)
{
uint flag=0;
List_iterator_fast<Item> it(fields_list);
Item *item;
while ((item= it++))
{
if (item->with_sum_func)
flag|=1;
else if (!(flag & 2) && !item->const_during_execution())
flag|=2;
}
if (having)
{
if (having->with_sum_func)
flag |= 1;
else if (!having->const_during_execution())
flag |= 2;
}
if (flag == 3)
{
my_message(ER_MIX_OF_GROUP_FUNC_AND_FIELDS,
ER(ER_MIX_OF_GROUP_FUNC_AND_FIELDS), MYF(0));
DBUG_RETURN(-1);
}
}
my_message(ER_MIX_OF_GROUP_FUNC_AND_FIELDS,
ER(ER_MIX_OF_GROUP_FUNC_AND_FIELDS), MYF(0));
DBUG_RETURN(-1);
}
{
/* Caclulate the number of groups */