• sergefp@mysql.com's avatar
    BUG#16798: Inapplicable ref_or_null query plan and bad query result on random occasions · 1b349cf8
    sergefp@mysql.com authored
    The bug was as follows: When merge_key_fields() encounters "t.key=X OR t.key=Y" it will 
    try to join them into ref_or_null access via "t.key=X OR NULL". In order to make this 
    inference it checks if Y<=>NULL, ignoring the fact that value of Y may be not yet known.
    
    The fix is that the check if Y<=>NULL is made only if value of Y is known (i.e. it is a
    constant).
    TODO: When merging to 5.0, replace used_tables() with const_item() everywhere in merge_key_fields().
    1b349cf8
innodb_mysql.test 1.81 KB