• unknown's avatar
    Bug#28494: Grouping by Item_func_set_user_var produces incorrect result. · 26f38860
    unknown authored
    This is an additional fix.
    Item::val_xxx methods are supposed to use original data source and
    Item::val_xxx_result methods to use the item's result field. But for the
    Item_func_set_user_var class val_xxx_result methods were mapped to val_xxx
    methods. This leads, in particular, to producing bad sort keys and thus
    wrong order of the result set of queries with group by/order by clauses.
    
    The set of val_xxx_result methods is added to the Item_func_set_user_var
    class. It's the same as the val_xxx set of method but uses the result_field
    to return a value.
    
    
    mysql-test/t/user_var.test:
      Corrected test case for hte bug#28494.
    mysql-test/r/user_var.result:
      Corrected test case for hte bug#28494.
    sql/item_func.cc:
      Bug#28494: Grouping by Item_func_set_user_var produces incorrect result.
      The set of val_xxx_result methods is added to the Item_func_set_user_var
      class. It's the same as the val_xxx set of method but uses the result_field
      to return a value.
    sql/item_func.h:
      Bug#28494: Grouping by Item_func_set_user_var produces incorrect result.
      The set of val_xxx_result methods is added to the Item_func_set_user_var
      class.
    26f38860
item_func.h 41.3 KB