• unknown's avatar
    Bug #20191: getTableName gives wrong or inconsistent result when using VIEWs · 59b45b5b
    unknown authored
    When compiling GROUP BY Item_ref instances are dereferenced in 
    setup_copy_fields(), i.e. replaced with the corresponding Item_field 
    (if they point to one) or Item_copy_string for the other cases.
    Since the Item_ref (in the Item_field case) is no longer used the information
    about the aliases stored in it is lost.   
    Fixed by preserving the column, table and DB alias on dereferencing Item_ref
    
    
    mysql-test/r/metadata.result:
      Bug #20191: getTableName gives wrong or inconsistent result when using VIEWs
       - test case
    mysql-test/t/metadata.test:
      Bug #20191: getTableName gives wrong or inconsistent result when using VIEWs
       - test case
    sql/item.cc:
      Bug #20191: getTableName gives wrong or inconsistent result when using VIEWs
       - use the table and db name to fill up the metadata for columns
    sql/sql_select.cc:
      Bug #20191: getTableName gives wrong or inconsistent result when using VIEWs
       - preserve the field, table and DB name on dereferencing an Item_ref
    59b45b5b
metadata.result 5.19 KB