dblink_connect grant privelages on foreign db table

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: zluther89(at)gmail(dot)com
Subject: dblink_connect grant privelages on foreign db table
Date: 2020-09-10 15:27:03
Message-ID: 159975162317.19777.1869528586555716998@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

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.

Browse pgsql-docs by date

  From Date Subject
Next Message Peter Eisentraut 2020-09-10 16:26:59 Re: Additional Chapter for Tutorial
Previous Message Magnus Hagander 2020-09-10 12:19:51 Re: typo in literature reference