• Jorgen Loland's avatar
    Bug#48177 - SELECTs with NOT IN subqueries containing NULL · 7f9a5047
    Jorgen Loland authored
                values return too many records
    
    WHERE clauses with "outer_value_list NOT IN subselect" were
    handled incorrectly if the outer value list contained multiple 
    items where at least one of these could be NULL. The first 
    outer record with NULL value was handled correctly, but if a 
    second record with NULL value existed, the optimizer would 
    choose to reuse the result it got on the last execution of the 
    subselect. This is incorrect if the outer value list has 
    multiple items.
         
    The fix is to make Item_in_optimizer::val_int (in 
    item_cmpfunc.cc) reuse the result of the latest execution
    for NULL values only if all values in the outer_value_list 
    are NULL.
    7f9a5047
subselect3.test 21.6 KB