Skip to content

Commit 62f36d6

Browse files
committed
postgres_fdw: Remove redundant check in semijoin_target_ok()
If a var belongs to the innerrel of the joinrel, it's not possible that it belongs to the outerrel. This commit removes the redundant check from the if-clause but keeps it as an assertion. Discussion: https://postgr.es/m/flat/CAHewXN=8aW4hd_W71F7Ua4+_w0=bppuvvTEBFBF6G0NuSXLwUw@mail.gmail.com Author: Tender Wang <tndrwang@gmail.com> Reviewed-by: Alexander Pyhalov <a.yhalov@postgrespro.ru> Backpatch-through: 17
1 parent 3c86223 commit 62f36d6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

contrib/postgres_fdw/postgres_fdw.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5768,15 +5768,15 @@ semijoin_target_ok(PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outerrel,
57685768
if (!IsA(var, Var))
57695769
continue;
57705770

5771-
if (bms_is_member(var->varno, innerrel->relids) &&
5772-
!bms_is_member(var->varno, outerrel->relids))
5771+
if (bms_is_member(var->varno, innerrel->relids))
57735772
{
57745773
/*
57755774
* The planner can create semi-join, which refers to inner rel
57765775
* vars in its target list. However, we deparse semi-join as an
57775776
* exists() subquery, so can't handle references to inner rel in
57785777
* the target list.
57795778
*/
5779+
Assert(!bms_is_member(var->varno, outerrel->relids));
57805780
ok = false;
57815781
break;
57825782
}

0 commit comments

Comments
 (0)