mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug#27874: Non-grouped columns are allowed by * in ONLY_FULL_GROUP_BY mode.
When fields are inserted instead of * in the select list they were not marked for check for the ONLY_FULL_GROUP_BY mode. The Field_iterator_table::create_item() function now marks newly created items for check when in the ONLY_FULL_GROUP_BY mode. The setup_wild() and the insert_fields() functions now maintain the cur_pos_in_select_list counter for the ONLY_FULL_GROUP_BY mode. sql/sql_base.cc: Bug#27874: Non-grouped columns are allowed by * in ONLY_FULL_GROUP_BY mode. The setup_wild() and the insert_fields() functions now maintain the cur_pos_in_select_list counter for the ONLY_FULL_GROUP_BY mode. sql/table.cc: Bug#27874: Non-grouped columns are allowed by * in ONLY_FULL_GROUP_BY mode. The Field_iterator_table::create_item() function now marks newly created items for check when in the ONLY_FULL_GROUP_BY mode. mysql-test/r/group_by.result: Added a test case for the bug#27874: Non-grouped columns are allowed by * in ONLY_FULL_GROUP_BY mode. mysql-test/t/group_by.test: Added a test case for the bug#27874: Non-grouped columns are allowed by * in ONLY_FULL_GROUP_BY mode.
This commit is contained in:
@ -4588,6 +4588,7 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields,
|
||||
*/
|
||||
arena= thd->activate_stmt_arena_if_needed(&backup);
|
||||
|
||||
thd->lex->current_select->cur_pos_in_select_list= 0;
|
||||
while (wild_num && (item= it++))
|
||||
{
|
||||
if (item->type() == Item::FIELD_ITEM &&
|
||||
@ -4629,7 +4630,10 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields,
|
||||
}
|
||||
wild_num--;
|
||||
}
|
||||
else
|
||||
thd->lex->current_select->cur_pos_in_select_list++;
|
||||
}
|
||||
thd->lex->current_select->cur_pos_in_select_list= UNDEF_POS;
|
||||
if (arena)
|
||||
{
|
||||
/* make * substituting permanent */
|
||||
@ -5134,6 +5138,7 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
|
||||
item->walk(&Item::reset_query_id_processor,
|
||||
(byte *)(&thd->query_id));
|
||||
}
|
||||
thd->lex->current_select->cur_pos_in_select_list++;
|
||||
}
|
||||
/*
|
||||
In case of stored tables, all fields are considered as used,
|
||||
|
Reference in New Issue
Block a user