diff options
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; |