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/sql/postgres_fdw.sql | |
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/sql/postgres_fdw.sql')
-rw-r--r-- | contrib/postgres_fdw/sql/postgres_fdw.sql | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/contrib/postgres_fdw/sql/postgres_fdw.sql b/contrib/postgres_fdw/sql/postgres_fdw.sql index 61cbf55ab93..f420b230e76 100644 --- a/contrib/postgres_fdw/sql/postgres_fdw.sql +++ b/contrib/postgres_fdw/sql/postgres_fdw.sql @@ -478,11 +478,10 @@ EXPLAIN (COSTS OFF, VERBOSE) EXECUTE join_stmt; EXECUTE join_stmt; -- change the session user to view_owner and execute the statement. Because of -- change in session user, the plan should get invalidated and created again. --- While creating the plan, it should throw error since there is no user mapping --- available for view_owner. +-- The join will not be pushed down since the joining relations do not have a +-- valid user mapping. SET SESSION ROLE view_owner; EXPLAIN (COSTS OFF, VERBOSE) EXECUTE join_stmt; -EXECUTE join_stmt; RESET ROLE; DEALLOCATE join_stmt; @@ -506,6 +505,10 @@ CREATE USER MAPPING FOR view_owner SERVER loopback; EXPLAIN (COSTS false, VERBOSE) EXECUTE join_stmt; EXECUTE join_stmt; +-- If a sub-join can't be pushed down, upper level join shouldn't be either. +EXPLAIN (COSTS false, VERBOSE) +SELECT t1.c1, t2.c1 FROM (ft5 t1 JOIN v_ft5 t2 ON (t1.c1 = t2.c1)) left join (ft5 t3 JOIN v_ft5 t4 ON (t3.c1 = t4.c1)) ON (t1.c1 = t3.c1); + -- recreate the dropped user mapping for further tests CREATE USER MAPPING FOR CURRENT_USER SERVER loopback; DROP USER MAPPING FOR PUBLIC SERVER loopback; |