dblink_connect grant privelages on foreign db table

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

dblink_connect grant privelages on foreign db table

PG Bug reporting form
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/12/contrib-dblink-connect.html
Description:

In this section of dblink_connect
```
CREATE SERVER fdtest FOREIGN DATA WRAPPER dblink_fdw OPTIONS (hostaddr
'127.0.0.1', dbname 'contrib_regression');

CREATE USER regress_dblink_user WITH PASSWORD 'secret';
CREATE USER MAPPING FOR regress_dblink_user SERVER fdtest OPTIONS (user
'regress_dblink_user', password 'secret');
GRANT USAGE ON FOREIGN SERVER fdtest TO regress_dblink_user;
GRANT SELECT ON TABLE foo TO regress_dblink_user;

\set ORIGINAL_USER :USER
\c - regress_dblink_user
SELECT dblink_connect('myconn', 'fdtest');
 dblink_connect
----------------
 OK
(1 row)

SELECT * FROM dblink('myconn','SELECT * FROM foo') AS t(a int, b text, c
text[]); ```

The GRANT SELECT seemingly attempts to give a local user permissions on a
table in a foreign db. This results in an error:
 ``` relation 'foo' does not exist ```

I would like to be able to local permissions on a user's ability to access
foreign tables, but this does not seem correct.