• unknown's avatar
    BUG#16798: Inapplicable ref_or_null query plan and bad query result on random occasions · 4427076e
    unknown 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().
    
    
    mysql-test/r/innodb_mysql.result:
      Testcase for BUG16798
    mysql-test/t/innodb_mysql.test:
      Testcase for BUG16798
    sql/sql_select.cc:
      BUG#16798: Inapplicable ref_or_null query plan and bad query result on random occasions 
      In merge_key_fields() don't call val->is_null() if the value of val is not known.
    4427076e
innodb_mysql.result 1.63 KB