diff options
Diffstat (limited to 'src/backend/optimizer/path/pathkeys.c')
-rw-r--r-- | src/backend/optimizer/path/pathkeys.c | 40 |
1 files changed, 7 insertions, 33 deletions
diff --git a/src/backend/optimizer/path/pathkeys.c b/src/backend/optimizer/path/pathkeys.c index d2e241c983c..c4e7f97f687 100644 --- a/src/backend/optimizer/path/pathkeys.c +++ b/src/backend/optimizer/path/pathkeys.c @@ -180,9 +180,6 @@ pathkey_is_redundant(PathKey *new_pathkey, List *pathkeys) * Given an expression and sort-order information, create a PathKey. * The result is always a "canonical" PathKey, but it might be redundant. * - * expr is the expression, and nullable_relids is the set of base relids - * that are potentially nullable below it. - * * If the PathKey is being generated from a SortGroupClause, sortref should be * the SortGroupClause's SortGroupRef; otherwise zero. * @@ -198,7 +195,6 @@ pathkey_is_redundant(PathKey *new_pathkey, List *pathkeys) static PathKey * make_pathkey_from_sortinfo(PlannerInfo *root, Expr *expr, - Relids nullable_relids, Oid opfamily, Oid opcintype, Oid collation, @@ -234,7 +230,7 @@ make_pathkey_from_sortinfo(PlannerInfo *root, equality_op); /* Now find or (optionally) create a matching EquivalenceClass */ - eclass = get_eclass_for_sort_expr(root, expr, nullable_relids, + eclass = get_eclass_for_sort_expr(root, expr, opfamilies, opcintype, collation, sortref, rel, create_it); @@ -257,7 +253,6 @@ make_pathkey_from_sortinfo(PlannerInfo *root, static PathKey * make_pathkey_from_sortop(PlannerInfo *root, Expr *expr, - Relids nullable_relids, Oid ordering_op, bool nulls_first, Index sortref, @@ -279,7 +274,6 @@ make_pathkey_from_sortop(PlannerInfo *root, return make_pathkey_from_sortinfo(root, expr, - nullable_relids, opfamily, opcintype, collation, @@ -584,12 +578,10 @@ build_index_pathkeys(PlannerInfo *root, } /* - * OK, try to make a canonical pathkey for this sort key. Note we're - * underneath any outer joins, so nullable_relids should be NULL. + * OK, try to make a canonical pathkey for this sort key. */ cpathkey = make_pathkey_from_sortinfo(root, indexkey, - NULL, index->sortopfamily[i], index->opcintype[i], index->indexcollations[i], @@ -743,14 +735,12 @@ build_partition_pathkeys(PlannerInfo *root, RelOptInfo *partrel, /* * Try to make a canonical pathkey for this partkey. * - * We're considering a baserel scan, so nullable_relids should be - * NULL. Also, we assume the PartitionDesc lists any NULL partition - * last, so we treat the scan like a NULLS LAST index: we have - * nulls_first for backwards scan only. + * We assume the PartitionDesc lists any NULL partition last, so we + * treat the scan like a NULLS LAST index: we have nulls_first for + * backwards scan only. */ cpathkey = make_pathkey_from_sortinfo(root, keyCol, - NULL, partscheme->partopfamily[i], partscheme->partopcintype[i], partscheme->partcollation[i], @@ -799,7 +789,7 @@ build_partition_pathkeys(PlannerInfo *root, RelOptInfo *partrel, * Build a pathkeys list that describes an ordering by a single expression * using the given sort operator. * - * expr, nullable_relids, and rel are as for make_pathkey_from_sortinfo. + * expr and rel are as for make_pathkey_from_sortinfo. * We induce the other arguments assuming default sort order for the operator. * * Similarly to make_pathkey_from_sortinfo, the result is NIL if create_it @@ -808,7 +798,6 @@ build_partition_pathkeys(PlannerInfo *root, RelOptInfo *partrel, List * build_expression_pathkey(PlannerInfo *root, Expr *expr, - Relids nullable_relids, Oid opno, Relids rel, bool create_it) @@ -827,7 +816,6 @@ build_expression_pathkey(PlannerInfo *root, cpathkey = make_pathkey_from_sortinfo(root, expr, - nullable_relids, opfamily, opcintype, exprCollation((Node *) expr), @@ -908,14 +896,11 @@ convert_subquery_pathkeys(PlannerInfo *root, RelOptInfo *rel, * expression is *not* volatile in the outer query: it's just * a Var referencing whatever the subquery emitted. (IOW, the * outer query isn't going to re-execute the volatile - * expression itself.) So this is okay. Likewise, it's - * correct to pass nullable_relids = NULL, because we're - * underneath any outer joins appearing in the outer query. + * expression itself.) So this is okay. */ outer_ec = get_eclass_for_sort_expr(root, (Expr *) outer_var, - NULL, sub_eclass->ec_opfamilies, sub_member->em_datatype, sub_eclass->ec_collation, @@ -997,7 +982,6 @@ convert_subquery_pathkeys(PlannerInfo *root, RelOptInfo *rel, /* See if we have a matching EC for the TLE */ outer_ec = get_eclass_for_sort_expr(root, (Expr *) outer_var, - NULL, sub_eclass->ec_opfamilies, sub_expr_type, sub_expr_coll, @@ -1138,13 +1122,6 @@ build_join_pathkeys(PlannerInfo *root, * The resulting PathKeys are always in canonical form. (Actually, there * is no longer any code anywhere that creates non-canonical PathKeys.) * - * We assume that root->nullable_baserels is the set of base relids that could - * have gone to NULL below the SortGroupClause expressions. This is okay if - * the expressions came from the query's top level (ORDER BY, DISTINCT, etc) - * and if this function is only invoked after deconstruct_jointree. In the - * future we might have to make callers pass in the appropriate - * nullable-relids set, but for now it seems unnecessary. - * * 'sortclauses' is a list of SortGroupClause nodes * 'tlist' is the targetlist to find the referenced tlist entries in */ @@ -1210,7 +1187,6 @@ make_pathkeys_for_sortclauses_extended(PlannerInfo *root, } pathkey = make_pathkey_from_sortop(root, sortkey, - root->nullable_baserels, sortcl->sortop, sortcl->nulls_first, sortcl->tleSortGroupRef, @@ -1268,7 +1244,6 @@ initialize_mergeclause_eclasses(PlannerInfo *root, RestrictInfo *restrictinfo) restrictinfo->left_ec = get_eclass_for_sort_expr(root, (Expr *) get_leftop(clause), - restrictinfo->nullable_relids, restrictinfo->mergeopfamilies, lefttype, ((OpExpr *) clause)->inputcollid, @@ -1278,7 +1253,6 @@ initialize_mergeclause_eclasses(PlannerInfo *root, RestrictInfo *restrictinfo) restrictinfo->right_ec = get_eclass_for_sort_expr(root, (Expr *) get_rightop(clause), - restrictinfo->nullable_relids, restrictinfo->mergeopfamilies, righttype, ((OpExpr *) clause)->inputcollid, |