• Evgeny Potemkin's avatar
    Bug#57039: constant subtime expression returns incorrect result. · 4bfec573
    Evgeny Potemkin authored
    The subtime function wasn't able to produce correct int representation of
    its result. For constant expressions the Item_datetime_cache is used to
    speedup evaluation and Item_datetime_cache expects underlying item to return
    correct int representation of DATETIME value. These two factors combined led
    to a wrong query result.
    
    Now the Item_func_add_time has function val_datetime which performs the
    calculation and saves result into given MYSQL_TIME struct, it also sets
    null_value to appropriate value. val_int and val_str member functions
    convert the result obtained from val_datetime to int or string respectively
    and returns it.
    4bfec573
func_time.test 35.2 KB