aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/plan/analyzejoins.c
diff options
context:
space:
mode:
authorDavid Rowley <drowley@postgresql.org>2024-10-15 21:14:21 +1300
committerDavid Rowley <drowley@postgresql.org>2024-10-15 21:14:21 +1300
commit2453196107de66cff0257feef2ff8585dcf9d924 (patch)
tree30cc541e1cb45cfd0189e0b83712c72a01abd1ee /src/backend/optimizer/plan/analyzejoins.c
parent7cdfeee320e72162b62dddddee638e713c2b8680 (diff)
downloadpostgresql-2453196107de66cff0257feef2ff8585dcf9d924.tar.gz
postgresql-2453196107de66cff0257feef2ff8585dcf9d924.zip
Move clause_sides_match_join() into restrictinfo.h
Two near-identical copies of clause_sides_match_join() existed in joinpath.c and analyzejoins.c. Deduplicate this by moving the function into restrictinfo.h. It isn't quite clear that keeping the inline property of this function is worthwhile, but this commit is just an exercise in code deduplication. More effort would be required to determine if the inline property is worth keeping. Author: James Hunter <james.hunter.pg@gmail.com> Discussion: https://postgr.es/m/CAJVSvF7Nm_9kgMLOch4c-5fbh3MYg%3D9BdnDx3Dv7Fcb64zr64Q%40mail.gmail.com
Diffstat (limited to 'src/backend/optimizer/plan/analyzejoins.c')
-rw-r--r--src/backend/optimizer/plan/analyzejoins.c31
1 files changed, 0 insertions, 31 deletions
diff --git a/src/backend/optimizer/plan/analyzejoins.c b/src/backend/optimizer/plan/analyzejoins.c
index 928d926645e..5bc16c4bfc7 100644
--- a/src/backend/optimizer/plan/analyzejoins.c
+++ b/src/backend/optimizer/plan/analyzejoins.c
@@ -116,37 +116,6 @@ restart:
}
/*
- * clause_sides_match_join
- * Determine whether a join clause is of the right form to use in this join.
- *
- * We already know that the clause is a binary opclause referencing only the
- * rels in the current join. The point here is to check whether it has the
- * form "outerrel_expr op innerrel_expr" or "innerrel_expr op outerrel_expr",
- * rather than mixing outer and inner vars on either side. If it matches,
- * we set the transient flag outer_is_left to identify which side is which.
- */
-static inline bool
-clause_sides_match_join(RestrictInfo *rinfo, Relids outerrelids,
- Relids innerrelids)
-{
- if (bms_is_subset(rinfo->left_relids, outerrelids) &&
- bms_is_subset(rinfo->right_relids, innerrelids))
- {
- /* lefthand side is outer */
- rinfo->outer_is_left = true;
- return true;
- }
- else if (bms_is_subset(rinfo->left_relids, innerrelids) &&
- bms_is_subset(rinfo->right_relids, outerrelids))
- {
- /* righthand side is outer */
- rinfo->outer_is_left = false;
- return true;
- }
- return false; /* no good for these input relations */
-}
-
-/*
* join_is_removable
* Check whether we need not perform this special join at all, because
* it will just duplicate its left input.