diff options
Diffstat (limited to 'src/backend/optimizer/path/indxpath.c')
-rw-r--r-- | src/backend/optimizer/path/indxpath.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c index 2f088b79787..89b42da6b46 100644 --- a/src/backend/optimizer/path/indxpath.c +++ b/src/backend/optimizer/path/indxpath.c @@ -2157,7 +2157,14 @@ match_pathkeys_to_index(IndexOptInfo *index, List *pathkeys, if (pathkey->pk_eclass->ec_has_volatile) return; - /* Try to match eclass member expression(s) to index */ + /* + * Try to match eclass member expression(s) to index. Note that child + * EC members are considered, but only when they belong to the target + * relation. (Unlike regular members, the same expression could be a + * child member of more than one EC. Therefore, the same index could + * be considered to match more than one pathkey list, which is OK + * here. See also get_eclass_for_sort_expr.) + */ foreach(lc2, pathkey->pk_eclass->ec_members) { EquivalenceMember *member = (EquivalenceMember *) lfirst(lc2); @@ -2581,15 +2588,6 @@ match_index_to_operand(Node *operand, int indkey; /* - * Ignore any PlaceHolderVar nodes above the operand. This is needed so - * that we can successfully use expression-index constraints pushed down - * through appendrels (UNION ALL). It's safe because a PlaceHolderVar - * appearing in a relation-scan-level expression is certainly a no-op. - */ - while (operand && IsA(operand, PlaceHolderVar)) - operand = (Node *) ((PlaceHolderVar *) operand)->phexpr; - - /* * Ignore any RelabelType node above the operand. This is needed to be * able to apply indexscanning in binary-compatible-operator cases. Note: * we can assume there is at most one RelabelType node; |