• Gleb Shchepa's avatar
    Bug #37761: IN handles NULL differently for table-subquery · e000e4a2
    Gleb Shchepa authored
                and value-list
    
    The server returns unexpected results if a right side of the 
    NOT IN clause consists of NULL value and some constants of
    the same type, for example:
    
      SELECT * FROM t WHERE NOT t.id IN (NULL, 1, 2) 
      
    may return 3, 4, 5 etc if a table contains these values.
    
    
    The Item_func_in::val_int method has been modified:
    unnecessary resets of an Item_func_case::has_null field 
    value has been moved outside of an argument comparison
    loop. (Also unnecessary re-initialization of the null_value
    field has been moved).
    
    
    mysql-test/r/func_in.result:
      Added test case for bug #37761.
    mysql-test/t/func_in.test:
      Added test case for bug #37761.
    sql/item_cmpfunc.cc:
      Bug #37761: IN handles NULL differently for table-subquery 
                  and value-list
      
      The Item_func_in::val_int method has been modified:
      unnecessary resets of an Item_func_case::has_null field 
      value has been moved outside of an argument comparison
      loop. (Also unnecessary re-initialization of the null_value
      field has been moved).
    e000e4a2
item_cmpfunc.cc 132 KB