• Mattias Jonsson's avatar
    Bug#37721: ORDER BY when WHERE contains non-partitioned · d3ea7430
    Mattias Jonsson authored
    index column
    
    There was actually two problems
    1) when clustered pk, order by non pk index should also
    compare with pk as last resort to differ keys from each
    other
    2) bug in the index search handling in ha_partition (was
    found when extending the test case
    
    Solution to 1 was to include the pk in key compare if
    clustered pk and search on other index.
    
    Solution for 2 was to remove the optimization from
    ordered scan to unordered scan if clustered pk.
    
    mysql-test/r/partition_innodb.result:
      Bug#37721: ORDER BY when WHERE contains non-partitioned
      index column
      
      updated test result.
    mysql-test/t/partition_innodb.test:
      Bug#37721: ORDER BY when WHERE contains non-partitioned
      index column
      
      Added test case for bug verification.
    sql/ha_partition.cc:
      Bug#37721: ORDER BY when WHERE contains non-partitioned
      index column
      
      using m_curr_key_info with both given index and PK
      if clustered PK.
      Also including PK in read_set.
      Added debug prints for easier verification.
    sql/ha_partition.h:
      Bug#37721: ORDER BY when WHERE contains non-partitioned
      index column
      
      Changed m_curr_key_info to a null terminated array
      with max 2 keys and a terminating null.
      For use with key_rec_cmp with both given index and PK.
    sql/key.cc:
      Bug#37721: ORDER BY when WHERE contains non-partitioned
      index column
      
      added handling of a null terminated array of keys for
      use in compare.
    d3ea7430
ha_partition.h 41.9 KB