• unknown's avatar
    Bug#28208: Wrong result of a non-const STRING function with a const DATETIME · 9aa67a40
    unknown authored
    function.
    
    A wrong  condition was used to check that the
    Arg_comparator::can_compare_as_dates() function calculated the value of the
    string constant. When comparing a non-const STRING function with a constant
    DATETIME function it leads to saving an arbitrary value as a cached value of
    the DATETIME function.
    
    Now the Arg_comparator::set_cmp_func() function initializes the const_value
    variable to the impossible DATETIME value (-1) and this const_value is
    cached only if it was changed by the Arg_comparator::can_compare_as_dates()
    function.
    
    
    mysql-test/t/type_datetime.test:
      Added a test case for the bug#28208: Wrong result of a non-const STRING function with a const DATETIME function.
    mysql-test/r/type_datetime.result:
      Added a test case for the bug#28208: Wrong result of a non-const STRING function with a const DATETIME function.
    sql/item_cmpfunc.cc:
      Bug#28208: Wrong result of a non-const STRING function with a const DATETIME
      function.
      Now the Arg_comparator::set_cmp_func() function initializes the const_value
      variable to the impossible DATETIME value (-1) and this const_value is
      cached only if it was changed by the Arg_comparator::can_compare_as_dates()
      function.
    9aa67a40
item_cmpfunc.cc 120 KB