• unknown's avatar
    Fixed bug#16272: IF function with decimal args can produce wrong result · 315a4613
    unknown authored
    The Item_func_if::fix_length_and_dec() function when calculating length of 
    result doesn't take into account unsigned_flag. But it is taken when 
    calculating length of temporary field. This result in creating field that 
    shorter than needed. Due to this, in the reported query 40.0 converted to 9.99.
    
    The function Item_func_if::fix_length_and_dec() now adds 1 to the max_length if 
    the unsigned_flag isn't set.
    
    
    sql/item_cmpfunc.cc:
      Fixed bug#16272: IF function with decimal args can produce wrong result
      The function Item_func_if::fix_length_and_dec() now adds 1 to the max_length if 
      the unsigned_flag isn't set.
    mysql-test/r/func_if.result:
      Added test case for bug#16272: IF function with decimal args can produce wrong result
    mysql-test/t/func_if.test:
      Added test case for bug#16272: IF function with decimal args can produce wrong result
    315a4613
func_if.test 2.55 KB