diff options
author | unknown <sanja@montyprogram.com> | 2013-01-16 15:11:13 +0200 |
---|---|---|
committer | unknown <sanja@montyprogram.com> | 2013-01-16 15:11:13 +0200 |
commit | a716b061676d01920fa83298cd1fbb57725d6ad9 (patch) | |
tree | 92feb20e407af0d325f817b06608e457b156dec7 /sql | |
parent | 12bf6fe85893f6a69a74ec1c733e533051058dd3 (diff) | |
download | mariadb-git-a716b061676d01920fa83298cd1fbb57725d6ad9.tar.gz |
MDEV-3988 fix.
Subquery turned into constant too late to be excluded from grouping list so test for constant added to the create_temp_table().
Diffstat (limited to 'sql')
-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 aa47793df8f..0897aa287db 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -13797,10 +13797,20 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields, if (group) { + ORDER **prev= &group; if (!param->quick_group) group=0; // Can't use group key else for (ORDER *tmp=group ; tmp ; tmp=tmp->next) { + /* Exclude found constant from the list */ + if ((*tmp->item)->const_item()) + { + *prev= tmp->next; + param->group_parts--; + continue; + } + else + prev= &(tmp->next); /* marker == 4 means two things: - store NULLs in the key, and |