• unknown's avatar
    Fix for bug #30666: Incorrect order when using range conditions on 2 · f6686659
    unknown authored
    tables or more
    
    The problem was that the optimizer used the join buffer in cases when
    the result set is ordered by filesort. This resulted in the ORDER BY
    clause being ignored, and the records being returned in the order
    determined by the order of matching records in the last table in join.
    
    Fixed by relaxing the condition in make_join_readinfo() to take
    filesort-ordered result sets into account, not only index-ordered ones.
    
    
    mysql-test/r/select.result:
      Added a test case for bug #30666.
    mysql-test/t/select.test:
      Added a test case for bug #30666.
    sql/sql_select.cc:
      Relaxed the condition to determine when the join buffer usage must be
      disabled. The condition is now true for cases when the result set is
      ordered by filesort, that is when 'join->order &&
      !join->skip_sort_order' is true.
    f6686659
select.result 116 KB