Commit 3b4de4c
committed
MDEV-32084: Assertion in best_extension_by_limited_search() ...
When subquery with LEFT JOIN is converted into semi-join, it is possible to construct cases where the LEFT JOIN's ON expression refers to a table in the current select but not in the current join nest. For example: t1 SEMI JOIN ( t2 LEFT JOIN (t3 LEFT JOIN t4 ON t4.col=t1.col) ON expr ) here, ON t4.col=t1.col" has this property. Let's denote it as ON-EXPR-HAS-REF-OUTSIDE-NEST. The optimizer handles LEFT JOINs like so: - Outer join runtime requires that "inner tables follow outer" in any join order. - Join optimizer enforces this by constructing join orders that follow table dependencies as they are specified in TABLE_LIST::dep_tables. - The dep_tables are set in simplify_joins() according to the contents of ON expressions and LEFT JOIN structure. However, the logic in simplify_joins() failed to account for possible ON-EXPR-HAS-REF-OUTSIDE-NEST. It assumed that references outside of the current join nest could only be OUTER_REF_TABLE_BIT or RAND_TABLE_BIT. The fix was to add the missing logic.1 parent d1a6792 commit 3b4de4c
File tree
4 files changed
+91
-4
lines changed- mysql-test/main
- sql
4 files changed
+91
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2051 | 2051 | | |
2052 | 2052 | | |
2053 | 2053 | | |
| 2054 | + | |
| 2055 | + | |
| 2056 | + | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
| 2061 | + | |
| 2062 | + | |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1458 | 1458 | | |
1459 | 1459 | | |
1460 | 1460 | | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2060 | 2060 | | |
2061 | 2061 | | |
2062 | 2062 | | |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
2063 | 2075 | | |
2064 | 2076 | | |
2065 | 2077 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18628 | 18628 | | |
18629 | 18629 | | |
18630 | 18630 | | |
| 18631 | + | |
| 18632 | + | |
18631 | 18633 | | |
18632 | 18634 | | |
18633 | 18635 | | |
| |||
18642 | 18644 | | |
18643 | 18645 | | |
18644 | 18646 | | |
18645 | | - | |
18646 | | - | |
18647 | | - | |
18648 | | - | |
| 18647 | + | |
| 18648 | + | |
| 18649 | + | |
| 18650 | + | |
| 18651 | + | |
| 18652 | + | |
18649 | 18653 | | |
| 18654 | + | |
| 18655 | + | |
| 18656 | + | |
| 18657 | + | |
| 18658 | + | |
| 18659 | + | |
| 18660 | + | |
| 18661 | + | |
| 18662 | + | |
| 18663 | + | |
| 18664 | + | |
| 18665 | + | |
| 18666 | + | |
| 18667 | + | |
| 18668 | + | |
| 18669 | + | |
| 18670 | + | |
| 18671 | + | |
| 18672 | + | |
| 18673 | + | |
| 18674 | + | |
| 18675 | + | |
| 18676 | + | |
| 18677 | + | |
| 18678 | + | |
| 18679 | + | |
| 18680 | + | |
| 18681 | + | |
| 18682 | + | |
| 18683 | + | |
| 18684 | + | |
| 18685 | + | |
| 18686 | + | |
| 18687 | + | |
| 18688 | + | |
| 18689 | + | |
| 18690 | + | |
| 18691 | + | |
| 18692 | + | |
| 18693 | + | |
| 18694 | + | |
| 18695 | + | |
| 18696 | + | |
| 18697 | + | |
| 18698 | + | |
| 18699 | + | |
18650 | 18700 | | |
18651 | 18701 | | |
18652 | 18702 | | |
| |||
0 commit comments