• Sergey Glukhov's avatar
    Bug#48483 crash in get_best_combination() · 3e1ee393
    Sergey Glukhov authored
    The crash happens because greedy_serach
    can not determine best plan due to
    wrong inner table dependences. These
    dependences affects join table sorting
    which performs before greedy_search starting.
    In our case table which has real 'no dependences'
    should be put on top of the list but it does not
    happen as inner tables have no dependences as well.
    The fix is to exclude RAND_TABLE_BIT mask from
    condition which checks if table dependences
    should be updated.
    
    
    mysql-test/r/join.result:
      test result
    mysql-test/t/join.test:
      test case
    sql/sql_select.cc:
      RAND_TABLE_BIT mask should not be counted as it
      prevents update of inner table dependences.
      For example it might happen if RAND() function
      is used in JOIN ON clause.
    3e1ee393
sql_select.cc 508 KB