1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-05 09:19:17 +03:00

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
This commit is contained in:
Alexander Korotkov 2025-03-25 12:48:48 +02:00
parent 729fe699e6
commit c5cf99e9e5

View File

@ -5758,8 +5758,7 @@ semijoin_target_ok(PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outerrel,
if (!IsA(var, Var))
continue;
if (bms_is_member(var->varno, innerrel->relids) &&
!bms_is_member(var->varno, outerrel->relids))
if (bms_is_member(var->varno, innerrel->relids))
{
/*
* The planner can create semi-join, which refers to inner rel
@ -5767,6 +5766,7 @@ semijoin_target_ok(PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outerrel,
* exists() subquery, so can't handle references to inner rel in
* the target list.
*/
Assert(!bms_is_member(var->varno, outerrel->relids));
ok = false;
break;
}