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 <
[email protected]>
Reviewed-by: Alexander Pyhalov <[email protected]>
Backpatch-through: 17
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
* 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;
}