• unknown's avatar
    Bug #31001: ORDER BY DESC in InnoDB not working · 9cde3729
    unknown authored
    The optimizer sets index traversal in reverse order only if there are 
    used key parts that are not compared to a constant.
    However using the primary key as an ORDER BY suffix rendered the check
    incomplete : going in reverse order must still be used even if 
    all the parts of the secondary key are compared to a constant.
    
    Fixed by relaxing the check and set reverse traversal even when all
    the secondary index keyparts are compared to a const.
    Also account for the case when all the primary keys are compared to a
    constant.
    
    
    mysql-test/include/mix1.inc:
      Bug #31001: test case
    mysql-test/r/innodb_mysql.result:
      Bug #31001: test case
    sql/sql_select.cc:
      Bug #31001: 
       - account for the case when all the primary key parts are compared
         to a constant.
       - force test_if_skip_sort_order to go backwards over the key even 
         when the number of keyparts used is the same as the number of
         keyparts equal to a constant. (because of the primary key
         suffix).
    9cde3729
innodb_mysql.result 34.6 KB