【发布时间】:2022-10-07 18:58:13
【问题描述】:
用户:jira_user 数据库:jiradb 作为 postgres 执行命令
GRANT USAGE ON schema public TO jira_user;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO jira_user;
grant all privileges on database jiradb to jira_user;
但即便如此,我在测试服务器上得到以下结果
SELECT * FROM information_schema.table_privileges where table_name = \'AO_013613_ACTIVITY_SOURCE\';
grantor | grantee | table_catalog | table_schema | table_name | privilege_type | is_grantable | with_hierarchy
----------+-----------+---------------+--------------+---------------------------+----------------+--------------+----------------
postgres | jira_user | jiradb | public | AO_013613_ACTIVITY_SOURCE | INSERT | NO | NO
postgres | jira_user | jiradb | public | AO_013613_ACTIVITY_SOURCE | SELECT | NO | YES
postgres | jira_user | jiradb | public | AO_013613_ACTIVITY_SOURCE | UPDATE | NO | NO
postgres | jira_user | jiradb | public | AO_013613_ACTIVITY_SOURCE | DELETE | NO | NO
postgres | jira_user | jiradb | public | AO_013613_ACTIVITY_SOURCE | TRUNCATE | NO | NO
postgres | jira_user | jiradb | public | AO_013613_ACTIVITY_SOURCE | REFERENCES | NO | NO
postgres | jira_user | jiradb | public | AO_013613_ACTIVITY_SOURCE | TRIGGER | NO | NO
从产品服务器 - 它应该看起来像这样
grantor | grantee | table_catalog | table_schema | table_name | privilege_type | is_grantable | with_hierarchy
-----------+-----------+---------------+--------------+---------------------------+----------------+--------------+----------------
jira_user | jira_user | jiradb | public | AO_013613_ACTIVITY_SOURCE | INSERT | YES | NO
jira_user | jira_user | jiradb | public | AO_013613_ACTIVITY_SOURCE | SELECT | YES | YES
jira_user | jira_user | jiradb | public | AO_013613_ACTIVITY_SOURCE | UPDATE | YES | NO
jira_user | jira_user | jiradb | public | AO_013613_ACTIVITY_SOURCE | DELETE | YES | NO
jira_user | jira_user | jiradb | public | AO_013613_ACTIVITY_SOURCE | TRUNCATE | YES | NO
jira_user | jira_user | jiradb | public | AO_013613_ACTIVITY_SOURCE | REFERENCES | YES | NO
jira_user | jira_user | jiradb | public | AO_013613_ACTIVITY_SOURCE | TRIGGER | YES | NO`
必须承认我并不完全喜欢 Postgres,但我希望授权命令能够解决这个问题,然后在 test 中也提供与 prod 中相同的输出。现在意识到第一列显示的是不同的“授予者”。不确定这是否重要。
-
我确实运行了赠款,但没有效果。但也许我没有完全理解 is_grantable 列。被理解为“授予/未授予”或者在阅读时可能是“可能授予/不可能授予”,这意味着我需要“在更高的层次上”做一些魔法来实现它可授予?
标签: sql postgresql permissions