diff options
author | Robert Haas <rhaas@postgresql.org> | 2016-03-28 21:50:28 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2016-03-28 21:50:28 -0400 |
commit | 5d4171d1c70edfe3e9be1de9e66603af28e3afe1 (patch) | |
tree | e74ee89c0af8ea0662fc001ba9ce965d6a2890c8 /contrib/postgres_fdw/postgres_fdw.c | |
parent | 868628e4fd44d75987d6c099ac63613cc5417629 (diff) | |
download | postgresql-5d4171d1c70edfe3e9be1de9e66603af28e3afe1.tar.gz postgresql-5d4171d1c70edfe3e9be1de9e66603af28e3afe1.zip |
Don't require a user mapping for FDWs to work.
Commit fbe5a3fb73102c2cfec11aaaa4a67943f4474383 accidentally changed
this behavior; put things back the way they were, and add some
regression tests.
Report by Andres Freund; patch by Ashutosh Bapat, with a bit of
kibitzing by me.
Diffstat (limited to 'contrib/postgres_fdw/postgres_fdw.c')
-rw-r--r-- | contrib/postgres_fdw/postgres_fdw.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c index f21689e73d1..4fbbde13bc5 100644 --- a/contrib/postgres_fdw/postgres_fdw.c +++ b/contrib/postgres_fdw/postgres_fdw.c @@ -3911,6 +3911,16 @@ foreign_join_ok(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype, List *otherclauses; /* + * Core code may call GetForeignJoinPaths hook even when the join + * relation doesn't have a valid user mapping associated with it. See + * build_join_rel() for details. We can't push down such join, since + * there doesn't exist a user mapping which can be used to connect to the + * foreign server. + */ + if (!OidIsValid(joinrel->umid)) + return false; + + /* * We support pushing down INNER, LEFT, RIGHT and FULL OUTER joins. * Constructing queries representing SEMI and ANTI joins is hard, hence * not considered right now. |