summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <sanja@montyprogram.com>2013-01-16 15:11:13 +0200
committerunknown <sanja@montyprogram.com>2013-01-16 15:11:13 +0200
commita716b061676d01920fa83298cd1fbb57725d6ad9 (patch)
tree92feb20e407af0d325f817b06608e457b156dec7 /sql
parent12bf6fe85893f6a69a74ec1c733e533051058dd3 (diff)
downloadmariadb-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.cc10
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