![](/img/trans.png)
[英]PostgreSQL postgres_fdw querying very slowly on large foreign table when using CURRENT_DATE - 1 but not with hardcoded date
[英]How to set up permissions on foreign table using postgres_fdw?
源数据位于数据库键的公共模式中的键表中(参考 pg 文档: https : //www.postgresql.org/docs/current/postgres-fdw.html ):
create table keys (
id varchar not null,
keyname varchar not null,
created timestamp default current_timestamp not null,
modified timestamp default current_timestamp not null
);
引用用户/模式/数据库是vids / public / vids 。
CREATE SERVER keys
FOREIGN DATA WRAPPER postgres_fdw
OPTIONS (host '1.2.3.4', port '5432', dbname 'keys');
CREATE USER MAPPING FOR vids
SERVER keys
OPTIONS (user 'keys', password 'keys');
create foreign table keys (
id varchar not null,
keyname varchar not null,
created timestamp default current_timestamp not null,
modified timestamp default current_timestamp not null
) server keys options (schema_name 'public', table_name 'keys');
vids=> select * from keys;
ERROR: permission denied for foreign table keys
鉴于用户密钥是外部数据库中密钥表的所有者,我不明白。 这里应该做什么?
来自@jjanes 的评论:
该错误消息表明问题是在本地端”。外部表的地方repfresentation由nowned
vids
和vids
没有权限给它,所以它从来没有得到足够远弄清楚,如果keys
访问keys
上外国
所以对我的步骤的更正是:
grant all on table keys to clips;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.