* initialize_mergeclause_eclasses * Set the EquivalenceClass links in a mergeclause restrictinfo. * * RestrictInfo contains fields in which we may cache pointers to * EquivalenceClasses for the left and right inputs of the mergeclause. * (If the mergeclause is a true equivalence clause these will be the * same EquivalenceClass, otherwise not.) If the mergeclause is either * used to genera
| 1780 | * they've been updated to point to canonical ECs. |
| 1781 | */ |
| 1782 | void |
| 1783 | initialize_mergeclause_eclasses(PlannerInfo *root, RestrictInfo *restrictinfo) |
| 1784 | { |
| 1785 | Expr *clause = restrictinfo->clause; |
| 1786 | Oid lefttype, |
| 1787 | righttype; |
| 1788 | |
| 1789 | /* Should be a mergeclause ... */ |
| 1790 | Assert(restrictinfo->mergeopfamilies != NIL); |
| 1791 | /* ... with links not yet set */ |
| 1792 | Assert(restrictinfo->left_ec == NULL); |
| 1793 | Assert(restrictinfo->right_ec == NULL); |
| 1794 | |
| 1795 | /* Need the declared input types of the operator */ |
| 1796 | op_input_types(((OpExpr *) clause)->opno, &lefttype, &righttype); |
| 1797 | |
| 1798 | /* Find or create a matching EquivalenceClass for each side */ |
| 1799 | restrictinfo->left_ec = |
| 1800 | get_eclass_for_sort_expr(root, |
| 1801 | (Expr *) get_leftop(clause), |
| 1802 | restrictinfo->nullable_relids, |
| 1803 | restrictinfo->mergeopfamilies, |
| 1804 | lefttype, |
| 1805 | ((OpExpr *) clause)->inputcollid, |
| 1806 | 0, |
| 1807 | NULL, |
| 1808 | true); |
| 1809 | restrictinfo->right_ec = |
| 1810 | get_eclass_for_sort_expr(root, |
| 1811 | (Expr *) get_rightop(clause), |
| 1812 | restrictinfo->nullable_relids, |
| 1813 | restrictinfo->mergeopfamilies, |
| 1814 | righttype, |
| 1815 | ((OpExpr *) clause)->inputcollid, |
| 1816 | 0, |
| 1817 | NULL, |
| 1818 | true); |
| 1819 | } |
| 1820 | |
| 1821 | /* |
| 1822 | * update_mergeclause_eclasses |
no test coverage detected