• Ramil Kalimullin's avatar
    Fix for bug#49199: Optimizer handles incorrectly: · f5b51bc1
    Ramil Kalimullin authored
    field='const1' AND field='const2' in some cases
    
    Building multiple equality predicates containing
    a constant which is compared as a datetime (with a field)
    we should take this fact into account and compare the 
    constant with another possible constatns as datetimes 
    as well.
    
    E.g. for the
    SELECT ... WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'
    we should compare '2001-01-01' with '2001-01-01 00:00:00' as
    datetimes but not as strings.
    
    
    mysql-test/r/select.result:
      Fix for bug#49199: Optimizer handles incorrectly: 
      field='const1' AND field='const2' in some cases
        - test result.
    mysql-test/t/select.test:
      Fix for bug#49199: Optimizer handles incorrectly: 
      field='const1' AND field='const2' in some cases
        - test case.
    sql/item_cmpfunc.cc:
      Fix for bug#49199: Optimizer handles incorrectly: 
      field='const1' AND field='const2' in some cases
        - adding a constant to Item_equal compare it as
      a datetime value with stored one if there's a 
      date[time] field in a equality predicate.
    sql/item_cmpfunc.h:
      Fix for bug#49199: Optimizer handles incorrectly: 
      field='const1' AND field='const2' in some cases
        - adding a constant to Item_equal compare it as
      a datetime value with stored one if there's a 
      date[time] field in a equality predicate.
    sql/sql_select.cc:
      Fix for bug#49199: Optimizer handles incorrectly: 
      field='const1' AND field='const2' in some cases
        - adding a constant to Item_equal compare it as
      a datetime value with stored one if there's a 
      date[time] field in a equality predicate.
    f5b51bc1
sql_select.cc 507 KB