* match_unsorted_outer * Creates possible join paths for processing a single join relation * 'joinrel' by employing either iterative substitution or * mergejoining on each of its possible outer paths (considering * only outer paths that are already ordered well enough for merging). * * We always generate a nestloop path for each available outer path. * In fact we may generate as man
| 1734 | * 'extra' contains additional input values |
| 1735 | */ |
| 1736 | static void |
| 1737 | match_unsorted_outer(PlannerInfo *root, |
| 1738 | RelOptInfo *joinrel, |
| 1739 | RelOptInfo *outerrel, |
| 1740 | RelOptInfo *innerrel, |
| 1741 | JoinType jointype, |
| 1742 | JoinPathExtraData *extra) |
| 1743 | { |
| 1744 | JoinType save_jointype = jointype; |
| 1745 | bool nestjoinOK; |
| 1746 | bool useallclauses; |
| 1747 | Path *inner_cheapest_total = innerrel->cheapest_total_path; |
| 1748 | Path *matpath = NULL; |
| 1749 | ListCell *lc1; |
| 1750 | |
| 1751 | if (jointype == JOIN_DEDUP_SEMI || jointype == JOIN_DEDUP_SEMI_REVERSE) |
| 1752 | jointype = JOIN_INNER; |
| 1753 | |
| 1754 | /* |
| 1755 | * Nestloop only supports inner, left, semi, and anti joins. Also, if we |
| 1756 | * are doing a right or full mergejoin, we must use *all* the mergeclauses |
| 1757 | * as join clauses, else we will not have a valid plan. (Although these |
| 1758 | * two flags are currently inverses, keep them separate for clarity and |
| 1759 | * possible future changes.) |
| 1760 | */ |
| 1761 | switch (jointype) |
| 1762 | { |
| 1763 | case JOIN_INNER: |
| 1764 | case JOIN_LEFT: |
| 1765 | case JOIN_SEMI: |
| 1766 | case JOIN_ANTI: |
| 1767 | case JOIN_LASJ_NOTIN: |
| 1768 | nestjoinOK = true; |
| 1769 | useallclauses = false; |
| 1770 | break; |
| 1771 | case JOIN_RIGHT: |
| 1772 | case JOIN_FULL: |
| 1773 | nestjoinOK = false; |
| 1774 | useallclauses = true; |
| 1775 | break; |
| 1776 | case JOIN_UNIQUE_OUTER: |
| 1777 | case JOIN_UNIQUE_INNER: |
| 1778 | jointype = JOIN_INNER; |
| 1779 | nestjoinOK = true; |
| 1780 | useallclauses = false; |
| 1781 | break; |
| 1782 | default: |
| 1783 | elog(ERROR, "unrecognized join type: %d", |
| 1784 | (int) jointype); |
| 1785 | nestjoinOK = false; /* keep compiler quiet */ |
| 1786 | useallclauses = false; |
| 1787 | break; |
| 1788 | } |
| 1789 | |
| 1790 | /* |
| 1791 | * If inner_cheapest_total is parameterized by the outer rel, ignore it; |
| 1792 | * we will consider it below as a member of cheapest_parameterized_paths, |
| 1793 | * but the other possibilities considered in this routine aren't usable. |
no test coverage detected