diff options
author | Robert Haas <rhaas@postgresql.org> | 2018-02-22 10:03:14 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2018-02-22 10:03:14 -0500 |
commit | 84cb51b4e24b4e3a7057105971d0d385e179d978 (patch) | |
tree | 0cb529ec7cbf4c1c39f6e22ad9a17b32e25bc9f7 /contrib/postgres_fdw/postgres_fdw.c | |
parent | de6428afe13bb6eb1c99a70aada1a105966bc27e (diff) | |
download | postgresql-84cb51b4e24b4e3a7057105971d0d385e179d978.tar.gz postgresql-84cb51b4e24b4e3a7057105971d0d385e179d978.zip |
postgres_fdw: Fix interaction of PHVs with child joins.
Commit f49842d1ee31b976c681322f76025d7732e860f3 introduced the
concept of a child join, but did not update this code accordingly.
Ashutosh Bapat, with cosmetic changes by me
Discussion: http://postgr.es/m/CAFjFpRf=J_KPOtw+bhZeURYkbizr8ufSaXg6gPEF6DKpgH-t6g@mail.gmail.com
Diffstat (limited to 'contrib/postgres_fdw/postgres_fdw.c')
-rw-r--r-- | contrib/postgres_fdw/postgres_fdw.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c index 941a2e75a53..e8a0d5482a8 100644 --- a/contrib/postgres_fdw/postgres_fdw.c +++ b/contrib/postgres_fdw/postgres_fdw.c @@ -4565,7 +4565,11 @@ foreign_join_ok(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype, foreach(lc, root->placeholder_list) { PlaceHolderInfo *phinfo = lfirst(lc); - Relids relids = joinrel->relids; + Relids relids; + + /* PlaceHolderInfo refers to parent relids, not child relids. */ + relids = IS_OTHER_REL(joinrel) ? + joinrel->top_parent_relids : joinrel->relids; if (bms_is_subset(phinfo->ph_eval_at, relids) && bms_nonempty_difference(relids, phinfo->ph_eval_at)) |