• Alexey Kopytov's avatar
    Bug #46159: simple query that never returns · 50534602
    Alexey Kopytov authored
     
    The external 'for' loop in remove_dup_with_compare() handled 
    HA_ERR_RECORD_DELETED by just starting over without advancing 
    to the next record which caused an infinite loop. 
     
    This condition could be triggered on certain data by a SELECT 
    query containing DISTINCT, GROUP BY and HAVING clauses. 
    
    Fixed remove_dup_with_compare() so that we always advance to 
    the next record when receiving HA_ERR_RECORD_DELETED from 
    rnd_next(). 
    
    mysql-test/r/distinct.result:
      Added a test case for bug #46159.
    mysql-test/t/distinct.test:
      Added a test case for bug #46159.
    sql/sql_select.cc:
      Fixed remove_dup_with_compare() so that we always advance to 
      the next record when receiving HA_ERR_RECORD_DELETED from 
      rnd_next().
    50534602
distinct.result 25.9 KB