• unknown's avatar
    Fixed bug #32815. · 62b65e98
    unknown authored
    The index (key_part_1, key_part-2) was erroneously considered as compatible
    with the required ordering in the function test_test_if_order_by_key when 
    a query with an ORDER BY clause contained a condition of the form
      key_part_1=const OR key_part_1 IS NULL 
    and the order list contained only key_part_2. This happened because the value
    of the const_key_parts field in the KEYUSE structure was not formed correctly
    for the keys that could be used for ref_or_null access. 
    This was fixed in the code of the update_ref_and_keys function.
    The problem could not manifest itself for MyISAM databases because the
    implementation of the keys_to_use_for_scanning() handler function always
    returns an empty bitmap for the MyISAM engine.
    
    
    mysql-test/r/innodb_mysql.result:
      Added a test case for bug #32815.
    mysql-test/t/innodb_mysql.test:
      Added a test case for bug #32815.
    sql/sql_select.cc:
      Fixed bug #32815.
      The index (key_part_1, key_part-2) was erroneously considered as compatible
      with the required ordering in the function test_test_if_order_by_key when 
      a query with an ORDER BY clause contained a condition of the form
        key_part_1=const OR key_part_1 IS NULL 
      and the order list contained only key_part_2. This happened because the value
      of the const_key_parts field in the KEYUSE structure was not formed correctly
      for the keys that could be used for ref_or_null access. 
      This was fixed in the code of the update_ref_and_keys function.
    62b65e98
sql_select.cc 497 KB