1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

bugfix: DISTINCT with const_item in ORDER BY

This commit is contained in:
unknown
2002-09-10 19:23:59 +00:00
parent c58354509a
commit a106f9ea43
3 changed files with 34 additions and 11 deletions

View File

@ -3598,7 +3598,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
List_iterator_fast<Item> li(fields);
Item *item;
Field **tmp_from_field=from_field;
while ((item=li++))
for(uint field_no=0; ((item=li++)); field_no++)
{
Item::Type type=item->type();
if (not_all_columns)
@ -3613,8 +3613,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
param->using_indirect_summary_function=1;
continue;
}
if (item->const_item()) // We don't have to store this
continue;
if (item->const_item() && field_no >= hidden_field_count)
continue; // We don't have to store this
}
if (type == Item::SUM_FUNC_ITEM && !group && !save_sum_fields)
{ /* Can't calc group yet */