• unknown's avatar
    Final solution for bug# 4302 "Ambiguos order by when renamed column is · 570923eb
    unknown authored
    identical to another in result"
    According to SQL standard queries like 
    "select t1.a as col from t1, t2 order by a" should return an error if
    both tables contain field a.
    
    
    mysql-test/r/order_by.result:
      Updated test to conform SQL-standard.
    mysql-test/t/order_by.test:
      Updated test to conform SQL-standard.
    sql/item.cc:
      find_item_in_list() has now one more out parameter which is not used
      in item.cc functions.
    sql/mysql_priv.h:
      find_item_in_list(): Added boolean out parameter "unaliased" which
      indicates that we have found field by its original name and not by
      its alias in item (select) list.
    sql/sql_base.cc:
      find_item_in_list(): Added boolean out parameter "unaliased" which
      indicates that we have found field by its original name and not by
      its alias in item (select) list. This means that additional check is
      required to ensure there will be no ambiguity if we would search for this
      field in all tables.
    sql/sql_select.cc:
      find_order_in_list(): If we have found field in select list by its
      original name and not by its alias then we should perform additional
      check to ensure that there will be no ambiguity if we will search for
      this field in all tables. Also small cleanup.
    570923eb
sql_select.cc 266 KB