diff options
author | Alexander Korotkov <akorotkov@postgresql.org> | 2025-03-25 12:48:48 +0200 |
---|---|---|
committer | Alexander Korotkov <akorotkov@postgresql.org> | 2025-03-25 12:49:01 +0200 |
commit | 62f36d6924c740b5a566d64c563789d20cd4a5e1 (patch) | |
tree | 53749565755ffc33ac933834cb69f174e9c2f052 | |
parent | 3c86223c998280ea313480d319ec39f802453218 (diff) | |
download | postgresql-62f36d6924c740b5a566d64c563789d20cd4a5e1.tar.gz postgresql-62f36d6924c740b5a566d64c563789d20cd4a5e1.zip |
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
-rw-r--r-- | contrib/postgres_fdw/postgres_fdw.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c index d94c4ce9fd7..7a5439a460b 100644 --- a/contrib/postgres_fdw/postgres_fdw.c +++ b/contrib/postgres_fdw/postgres_fdw.c @@ -5768,8 +5768,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 @@ -5777,6 +5776,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; } |