【发布时间】:2013-11-18 00:55:26
【问题描述】:
我需要允许SELECT 访问数据库的用户。我已经按照我发现分散在 SO 各处的所有说明进行操作,但我什么也做不了。
我已经尝试了以下所有链接的所有建议解决方案:
How do you create a read-only user in PostgreSQL?
ERROR: permission denied for relation tablename on Postgres while trying a SELECT as a readonly user
Permission denied for relation
...以及更多对 PSQL 文档、博客和用户组的引用。什么都没有。
以下是我最近作为 postgres 用户用来授予权限的命令:
postgres@dev:~$ psql
psql (9.1.9)
Type "help" for help.
postgres=# grant usage on SCHEMA public to proton_read;
GRANT
postgres=# grant select on all tables in schema public to proton_read;
GRANT
postgres=# alter default privileges in schema public grant select on tables to proton_read;
ALTER DEFAULT PRIVILEGES
以下是作为只读用户使用的命令:
proton_read@dev:~$ psql proton
psql (9.1.9)
Type "help" for help.
proton=> select * from leads_lead limit 1;
ERROR: permission denied for relation leads_lead
这是踢球者,我曾经有过这个工作。我有一个示例数据库转储,用于向业务同事教授基本 SQL。我们涵盖了简单的命令,例如SELECT、ORDER BY、LIMIT 和JOIN。我有一个旧转储,并且能够授予只读访问权限。我删除了数据库并使用更新版本的数据库执行了 pg_restore,现在我无法重新授予 SELECT 访问权限。
任何帮助将不胜感激。
【问题讨论】:
标签: sql postgresql