diff options
Diffstat (limited to 'sql/table.cc')
-rw-r--r-- | sql/table.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sql/table.cc b/sql/table.cc index 39bdbb4cbb9..9be98eb14b9 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -3552,7 +3552,16 @@ const char *Field_iterator_table::name() Item *Field_iterator_table::create_item(THD *thd) { - return new Item_field(thd, &thd->lex->current_select->context, *ptr); + SELECT_LEX *select= thd->lex->current_select; + + Item_field *item= new Item_field(thd, &select->context, *ptr); + if (item && thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY && + !thd->lex->in_sum_func && select->cur_pos_in_select_list != UNDEF_POS) + { + select->non_agg_fields.push_back(item); + item->marker= select->cur_pos_in_select_list; + } + return item; } |