diff options
author | Alexander Korotkov <akorotkov@postgresql.org> | 2024-05-06 14:35:58 +0300 |
---|---|---|
committer | Alexander Korotkov <akorotkov@postgresql.org> | 2024-05-06 14:36:36 +0300 |
commit | d1d286d83c0eed695910cb20d970ea9bea2e5001 (patch) | |
tree | 3efaf5b6598e109bdf24b81c5d9b165ce17ec9fe /src/backend/optimizer/path/indxpath.c | |
parent | 81b2252e609cfa74550dd6804949485c094e4b85 (diff) | |
download | postgresql-d1d286d83c0eed695910cb20d970ea9bea2e5001.tar.gz postgresql-d1d286d83c0eed695910cb20d970ea9bea2e5001.zip |
Revert: Remove useless self-joins
This commit reverts d3d55ce5713 and subsequent fixes 2b26a694554, 93c85db3b5b,
b44a1708abe, b7f315c9d7d, 8a8ed916f73, b5fb6736ed3, 0a93f803f45, e0477837ce4,
a7928a57b9f, 5ef34a8fc38, 30b4955a466, 8c441c08279, 028b15405b4, fe093994db4,
489072ab7a9, and 466979ef031.
We are quite late in the release cycle and new bugs continue to appear. Even
though we have fixes for all known bugs, there is a risk of throwing many
bugs to end users.
The plan for self-join elimination would be to do more review and testing,
then re-commit in the early v18 cycle.
Reported-by: Tom Lane
Discussion: https://postgr.es/m/2422119.1714691974%40sss.pgh.pa.us
Diffstat (limited to 'src/backend/optimizer/path/indxpath.c')
-rw-r--r-- | src/backend/optimizer/path/indxpath.c | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c index 2230b131047..c0fcc7d78df 100644 --- a/src/backend/optimizer/path/indxpath.c +++ b/src/backend/optimizer/path/indxpath.c @@ -3441,22 +3441,6 @@ relation_has_unique_index_for(PlannerInfo *root, RelOptInfo *rel, List *restrictlist, List *exprlist, List *oprlist) { - return relation_has_unique_index_ext(root, rel, restrictlist, - exprlist, oprlist, NULL); -} - -/* - * relation_has_unique_index_ext - * Same as relation_has_unique_index_for(), but supports extra_clauses - * parameter. If extra_clauses isn't NULL, return baserestrictinfo clauses - * which were used to derive uniqueness. - */ -bool -relation_has_unique_index_ext(PlannerInfo *root, RelOptInfo *rel, - List *restrictlist, - List *exprlist, List *oprlist, - List **extra_clauses) -{ ListCell *ic; Assert(list_length(exprlist) == list_length(oprlist)); @@ -3511,7 +3495,6 @@ relation_has_unique_index_ext(PlannerInfo *root, RelOptInfo *rel, { IndexOptInfo *ind = (IndexOptInfo *) lfirst(ic); int c; - List *exprs = NIL; /* * If the index is not unique, or not immediately enforced, or if it's @@ -3563,24 +3546,6 @@ relation_has_unique_index_ext(PlannerInfo *root, RelOptInfo *rel, if (match_index_to_operand(rexpr, c, ind)) { matched = true; /* column is unique */ - - if (bms_membership(rinfo->clause_relids) == BMS_SINGLETON) - { - MemoryContext oldMemCtx = - MemoryContextSwitchTo(root->planner_cxt); - - /* - * Add filter clause into a list allowing caller to - * know if uniqueness have made not only by join - * clauses. - */ - Assert(bms_is_empty(rinfo->left_relids) || - bms_is_empty(rinfo->right_relids)); - if (extra_clauses) - exprs = lappend(exprs, rinfo); - MemoryContextSwitchTo(oldMemCtx); - } - break; } } @@ -3623,11 +3588,7 @@ relation_has_unique_index_ext(PlannerInfo *root, RelOptInfo *rel, /* Matched all key columns of this index? */ if (c == ind->nkeycolumns) - { - if (extra_clauses) - *extra_clauses = exprs; return true; - } } return false; |