• kaa@kaamos.(none)'s avatar
    Fix for bug #34928: Confusion by having Primary Key and Index · b753e4a0
    kaa@kaamos.(none) authored
    The bug is a regression introduced in 5.1 by the patch for bug28404.
    
    Under some circumstances test_if_skip_sort_order() could leave some
    data structures in an inconsistent state so that some parts of code
    could assume the selected execution strategy for GROUP BY/DISTINCT as
    a loose index scan (e.g. JOIN_TAB::is_using_loose_index_scan()), while
    the actual strategy chosen was an ordered index scan, which led to
    wrong data being returned.
    
    Fixed test_if_skip_sort_order() so that when changing the type for a
    join table, select->quick is reset not only for EXPLAIN, but for the 
    actual join execution as well, to not confuse code that depends on its
    value to determine the chosen GROUP BY/DISTINCT strategy.
    b753e4a0
sql_select.cc 528 KB