Skip to content

Commit c5cf99e

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 729fe69 commit c5cf99e

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
@@ -5758,15 +5758,15 @@ semijoin_target_ok(PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outerrel,
57585758
if (!IsA(var, Var))
57595759
continue;
57605760

5761-
if (bms_is_member(var->varno, innerrel->relids) &&
5762-
!bms_is_member(var->varno, outerrel->relids))
5761+
if (bms_is_member(var->varno, innerrel->relids))
57635762
{
57645763
/*
57655764
* The planner can create semi-join, which refers to inner rel
57665765
* vars in its target list. However, we deparse semi-join as an
57675766
* exists() subquery, so can't handle references to inner rel in
57685767
* the target list.
57695768
*/
5769+
Assert(!bms_is_member(var->varno, outerrel->relids));
57705770
ok = false;
57715771
break;
57725772
}

0 commit comments

Comments
 (0)