• Gleb Shchepa's avatar
    backport from 6.0: · 5e2fe847
    Gleb Shchepa authored
    Bug #40925: Equality propagation takes non indexed attribute
    
    Query execution plans and execution time of queries like
    
      select a, b, c from t1
        where a > '2008-11-21' and b = a limit 10
    
    depended on the order of equality operator parameters:
    "b = a" and "a = b" are not same. 
    
    
    An equality propagation algorithm has been fixed:
    the substitute_for_best_equal_field function should not
    substitute a field for an equal field if both fields belong
    to the same table.
    
    
    mysql-test/r/select.result:
      Added test case for bug #40925.
    mysql-test/t/select.test:
      Added test case for bug #40925.
    sql/item.cc:
      Bug #40925: Equality propagation takes non indexed attribute
      
      An equality propagation algorithm has been fixed:
      the substitute_for_best_equal_field function should not 
      substitute a field for an equal field if both fields belong
      to the same table.
    5e2fe847
select.result 126 KB