• unknown's avatar
    Fix bug #12922 if(sum(),...) with group from view returns wrong results · 792221e3
    unknown authored
    Fields of view represented by Item_direct_view_ref. When complex expression
    such as if(sum()>...,...) is splited in simpler parts by refs was ignored.
    Beside this direct ref doesn't use it's result_field and thus can't store
    it's result in tmp table which is needed for sum() ... group.
    All this results in reported bug.
    
    Item::split_sum_func2() now converts Item_direct_view_ref to Item_ref to
    make fields from view being storable in tmp table.
    
    
    sql/item.h:
      Fix bug #12922 if(sum(),...) with group from view returns wrong results
      Added function ref_type() to distinguish Item_ref subclasses
    sql/item.cc:
      Fix bug #12922 if(sum(),...) with group from view returns wrong results
       Item::split_sum_func2() now converts Item_direct_view_ref to Item_ref to make fields from view being storable in tmp table.
    mysql-test/t/view.test:
      Test case for bug#12922 if(sum(),...) with group from view returns wrong results
    mysql-test/r/view.result:
      Test case for bug#12922 if(sum(),...) with group from view returns wrong results
    792221e3
item.h 69.5 KB