-
Georgi Kodinov authored
The greedy optimizer tracks the current level of nested joins and the position inside these by setting and maintaining a state that's global for the whole FROM clause. This state was correctly maintained inside the selection of the next partial plan table (in best_extension_by_limited_search()). greedy_search() also moves the current position by adding the last partial match table when there's not enough tables in the partial plan found by best_extension_by_limited_search(). This may require update of the global state variables that describe the current position in the plan if the last table placed by greedy_search is not a top-level join table. Fixed by updating the state after placing the partial plan table in greedy_search() in the same way this is done on entering the best_extension_by_limited_search(). Fixed the signature of the function called to update the state : check_interleaving_with_nj mysql-test/r/greedy_optimizer.result: Bug #38795: test case mysql-test/t/greedy_optimizer.test: Bug #38795: test case sql/sql_select.cc: Bug #38795: correctly update current position when placing the next partial plan table in greedy_search().
ba47e3bc