• Sergey Petrunya's avatar
    MDEV-5161: Wrong result (missing rows) with semijoin, LEFT JOIN, ORDER BY, constant table · c4defdc8
    Sergey Petrunya authored
    - Don't pull out a table out of a semi-join if it is on the inner side of an outer join.
    - Make join->sort_by_table= get_sort_by_table(...) call after const table detection 
      is done. That way, the value of join->sort_by_table will match the actual execution.
      Which will allow the code in setup_semijoin_dups_elimination() (search for 
      "Make sure that possible sorting of rows from the head table is not to be employed." 
      to see that "Using filesort" is going to be used together with Duplicate Elimination (
      and change it to Using temporary + Using filesort)
    c4defdc8
sql_select.cc 771 KB