• unknown's avatar
    Fixed bug #29392. · 5d88b654
    unknown authored
    This bug may manifest itself for select queries over a multi-table view
    that includes an ORDER BY clause in its definition. If the select list of 
    the query contains references to the same view column with different
    aliases the names of the columns in the result output will be nevertheless
    the same, coinciding with one of the alias.
    
    The bug happened because the method Item_ref::get_tmp_table_item that
    was inherited by the class Item_direct_view_ref ignored the fact that
    the name of the view column reference must be inherited by the fields
    of the temporary table that was created in order to get the result rows
    sorted.
    
    
    mysql-test/r/view.result:
      Added a test case for bug #29392.
    mysql-test/t/view.test:
      Added a test case for bug #29392.
    sql/item.h:
      Fixed bug #29392.
      This bug may manifest itself for select queries over a multi-table view
      that includes an ORDER BY clause in its definition. If the select list of 
      the query contains references to the same view column with different
      aliases the names of the columns in the result output will be nevertheless
      the same, coinciding with one of the alias.
      
      The bug happened because the method Item_ref::get_tmp_table_item that
      was inherited by the class Item_direct_view_ref ignored the fact that
      the name of the view column reference must be inherited by the fields
      of the temporary table that was created in order to get the result rows
      sorted.
      
      Fixed by providing a proper implementation of the get_tmp_table_item 
      method for the Item_direct_view_ref class.
    5d88b654
view.test 85.8 KB