• Sergey Petrunya's avatar
    Apply fix by Roy Lyseng: · 47d0cf29
    Sergey Petrunya authored
    Bug#48623: Multiple subqueries are optimized incorrectly
          
    The function setup_semijoin_dups_elimination() has a major loop that
    goes through every table in the JOIN object. Usually, there is a normal
    "plus one" increment in the for loop that implements this, but each semijoin
    nest is treated as one entity and there is another increment that skips past
    the semijoin nest to the next table in the JOIN object. However, when
    combining these two increments, the next joined table is skipped, and if that
    happens to be the start of another semijoin nest, the correct processing
    for that nest will not be carried out.
    
    mysql-test/r/subselect_sj.result:
      Added test results for bug#48623
    mysql-test/r/subselect_sj_jcl6.result:
      Added test results for bug#48623
    mysql-test/t/subselect_sj.test:
      Added test case for bug#48623
    sql/opt_subselect.cc:
      Omitted the "plus one" increment in the for loop, added "plus one"
      in the remaining switch case, fixed coding style issue in remaining
      increment operations.
    47d0cf29
subselect_sj.result 40.8 KB