Bug#19880368 : GROUP_CONCAT CRASHES AFTER DUMP_LEAF_KEY
Problem: find_order_by_list does not update the address of order_item correctly after resolving. Solution: Change the ref_by address for a order_by field if its SUM_FUNC_ITEM to the address of the field present in all_fields.
This commit is contained in:
parent
1a5b8122b6
commit
674367afd5
@ -15158,6 +15158,17 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
|
|||||||
uint el= all_fields.elements;
|
uint el= all_fields.elements;
|
||||||
all_fields.push_front(order_item); /* Add new field to field list. */
|
all_fields.push_front(order_item); /* Add new field to field list. */
|
||||||
ref_pointer_array[el]= order_item;
|
ref_pointer_array[el]= order_item;
|
||||||
|
/*
|
||||||
|
If the order_item is a SUM_FUNC_ITEM, when fix_fields is called
|
||||||
|
ref_by is set to order->item which is the address of order_item.
|
||||||
|
But this needs to be address of order_item in the all_fields list.
|
||||||
|
As a result, when it gets replaced with Item_aggregate_ref
|
||||||
|
object in Item::split_sum_func2, we will be able to retrieve the
|
||||||
|
newly created object.
|
||||||
|
*/
|
||||||
|
if (order_item->type() == Item::SUM_FUNC_ITEM)
|
||||||
|
((Item_sum *)order_item)->ref_by= all_fields.head_ref();
|
||||||
|
|
||||||
order->item= ref_pointer_array + el;
|
order->item= ref_pointer_array + el;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user