• Gleb Shchepa's avatar
    Backport of fix to bug #33629 into mysql-next-mr-bugfixing. · 1360ca09
    Gleb Shchepa authored
    Bug #33629: last_day function can return null, but has 'not null' flag set for result
    
    LAST_DAY and MAKEDATE functions are documented as
    returning NULL value, but actually they was implemented
    as returning NOT NULL typed values.
    
    That caused a confusing error "ERROR 1048 (23000): Column
    '...' cannot be null" on queries like: 
    
      SELECT 1 FROM (SELECT LAST_DAY('0')) a;
    
    
    mysql-test/r/func_sapdb.result:
        Updated test case for bug #33629.
    mysql-test/r/func_time.result:
        Updated test case for bug #33629.
    mysql-test/r/type_date.result:
        Added test case for bug #33629.
    mysql-test/t/type_date.test:
        Added test case for bug #33629.
    sql/item_timefunc.h:
        Bug #33629: last_day function can return null, but has 'not null' flag set for result
        
        1. The Item_func_makedate::fix_length_and_dec method
           has been modified to declare MAKEDATE() as a function
           returning nullable value.
        2. The Item_func_last_day::fix_length_and_dec method
           has been overloaded for the same purpose.
    1360ca09
func_time.result 55.6 KB