我想为开发人员创建一个专用角色,以便从 pgadmin 访问 pgagent。我这样做了:
CREATE ROLE pgagent_dev NOSUPERUSER NOCREATEDB NOCREATEROLE NOINHERIT NOLOGIN;
COMMENT ON ROLE pgagent_dev IS 'Role dedicated to Developers access to pgagent';
GRANT USAGE ON SCHEMA pgagent TO pgagent_dev ;
-- GRANT ALL ON SCHEMA pgagent TO pgagent_dev;
GRANT SELECT ON ALL TABLES IN SCHEMA pgagent TO pgagent_dev;
GRANT SELECT ON ALL SEQUENCES IN SCHEMA pgagent TO pgagent_dev;
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA pgagent TO pgagent_dev;
GRANT pgagent_dev TO toto;
GRANT pgagent_dev TO tutu;
从 pgadmin 中,他们可以看到 pgagent 文件夹,但无法展开,并且 postgresql 显示此日志。
2019-12-10 10:29:39.327 +07 [24784] ERROR: permission denied for schema pgagent
2019-12-10 10:29:39.327 +07 [24784] STATEMENT:
SELECT
has_table_privilege(
'pgagent.pga_job', 'INSERT, SELECT, UPDATE'
) has_priviledge
WHERE EXISTS(
SELECT has_schema_privilege('pgagent', 'USAGE')
WHERE EXISTS(
SELECT cl.oid FROM pg_class cl
LEFT JOIN pg_namespace ns ON ns.oid=relnamespace
WHERE relname='pga_job' AND nspname='pgagent'
)
)
我做错了什么或忘记了什么?谢谢。