• evgen@moonbone.local's avatar
    Bug#28494: Grouping by Item_func_set_user_var produces incorrect result. · f70ae3a6
    evgen@moonbone.local authored
    The end_update() function uses the Item::save_org_in_field() function to
    save original values of items into the group buffer. But for the 
    Item_func_set_user_var this method was mapped to the save_in_field method.
    The latter function wrongly decides to use the result_field. This leads to
    saving incorrect value in the grouping buffer and wrong result of the whole
    query.
    
    The can_use_result_field argument of the bool type is added to the
    Item_func_set_user_var::save_in_field() function. If it is set to FALSE
    then the item's result field won't be used. Otherwise it will be detected
    whether the result field will be used (old behaviour).
    Two wrapping functions for the function above are added to the 
    Item_func_set_user_var class:
    the save_in_field(Field *field, bool no_conversions) - it calls the above
    function with the can_use_result_field set to TRUE.
    the save_org_in_field(Field *field) - same, but the can_use_result_field
    is set to FALSE.
    f70ae3a6
item_func.h 41.2 KB