diff options
author | Georgi Kodinov <kgeorge@mysql.com> | 2008-11-24 18:00:09 +0200 |
---|---|---|
committer | Georgi Kodinov <kgeorge@mysql.com> | 2008-11-24 18:00:09 +0200 |
commit | f31d305238d1f6c51ca03b23b119d602c149c75d (patch) | |
tree | eab163c66942e3ede5ce1b97429ead8b9bbea8fc /sql/sql_select.cc | |
parent | 3374afe8b0c1d4a5a92c43eaf71c76bc481f42f7 (diff) | |
parent | c9be1c9f88dac50e75d4b51399c01986f23c4642 (diff) | |
download | mariadb-git-f31d305238d1f6c51ca03b23b119d602c149c75d.tar.gz |
merged bug 39656 to 5.1-bugteam
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 7e37bd7c67d..b1f74d26db3 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -402,11 +402,21 @@ inline int setup_without_group(THD *thd, Item **ref_pointer_array, { int res; nesting_map save_allow_sum_func=thd->lex->allow_sum_func ; + /* + Need to save the value, so we can turn off only the new NON_AGG_FIELD + additions coming from the WHERE + */ + uint8 saved_flag= thd->lex->current_select->full_group_by_flag; DBUG_ENTER("setup_without_group"); thd->lex->allow_sum_func&= ~(1 << thd->lex->current_select->nest_level); res= setup_conds(thd, tables, leaves, conds); + /* it's not wrong to have non-aggregated columns in a WHERE */ + if (thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY) + thd->lex->current_select->full_group_by_flag= saved_flag | + (thd->lex->current_select->full_group_by_flag & ~NON_AGG_FIELD_USED); + thd->lex->allow_sum_func|= 1 << thd->lex->current_select->nest_level; res= res || setup_order(thd, ref_pointer_array, tables, fields, all_fields, order); |