• unknown's avatar
    BUG#17047: CHAR() and IN() can return NULL without signaling NULL result · e40e8052
    unknown authored
    The problem was that some functions (namely IN() starting with 4.1, and
    CHAR() starting with 5.0) were returning NULL in certain conditions,
    while they didn't set their maybe_null flag.  Because of that there could
    be some problems with 'IS NULL' check, and statements that depend on the
    function value domain, like CREATE TABLE t1 SELECT 1 IN (2, NULL);.
    
    The fix is to set maybe_null correctly.
    
    
    mysql-test/r/func_in.result:
      Add result for bug#17047: CHAR() and IN() can return NULL without
      signaling NULL result.
    mysql-test/t/func_in.test:
      Add test case for bug#17047: CHAR() and IN() can return NULL without
      signaling NULL result.
    sql/item_cmpfunc.cc:
      Remove assignment to maybe_null, as it was already set in fix_fields()
      based on all arguments, not only on the first.
    e40e8052
item_cmpfunc.cc 70.2 KB