如何修改PostgreSQL数据库中所有表的所有者?
我试过,ALTER TABLE * OWNER TO new_owner但它不支持星号语法.
我试着运行简单的sql命令:
select * from site_adzone;
Run Code Online (Sandbox Code Playgroud)
我收到了这个错误
ERROR: permission denied for relation site_adzone
Run Code Online (Sandbox Code Playgroud)
这可能是什么问题?
我也尝试选择其他表并得到同样的问题.我也试过这样做:
GRANT ALL PRIVILEGES ON DATABASE jerry to tom;
Run Code Online (Sandbox Code Playgroud)
但我从控制台得到了这个回应
WARNING: no privileges were granted for "jerry"
Run Code Online (Sandbox Code Playgroud)
你知道什么是错的吗?
我有这些用户:
postgres | Create role, Create DB | {cloudsqlsuperuser}
proxyuser | Create role, Create DB | {cloudsqlsuperuser}
qa|Create role, Create DB | {cloudsqlsuperuser}
Run Code Online (Sandbox Code Playgroud)
还有这些表:
List of relations
Schema | Name | Type | Owner
--------+--------------------+-------+-----------
public | member_preferences | table | proxyuser
public | message_queue | table | proxyuser
public | pubsub_queue | table | proxyuser
Run Code Online (Sandbox Code Playgroud)
我目前以 postgres 用户身份登录,并希望授予 qa 用户权限以读取和写入任何这些表以及将来在该模式中创建的任何表。
我试图遵循这一点。
但是,当我运行GRANT SELECT ON ALL TABLES IN SCHEMA public TO qa;
它时,
它会响应:
ERROR: permission denied …
我有一个需要允许SELECT访问数据库的用户。我遵循了我发现的所有指示,分散在整个SO中,我什么也无法工作。
我已经尝试了以下所有链接的所有建议解决方案:
错误:尝试将SELECT作为只读用户时,对Postgres上的关系表名的权限被拒绝
...以及更多有关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
Run Code Online (Sandbox Code Playgroud)
以下是用作只读用户的命令:
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
Run Code Online (Sandbox Code Playgroud)
这是踢球手,我曾经做过一次这项工作。我有一个示例数据库转储,用于向业务同事教授基本的SQL。我们覆盖简单的命令,如SELECT, …