暂无图片
usage_privileges 中没有数据,但是super用户已经授权成功了
我来答
分享
暂无图片 匿名用户
usage_privileges 中没有数据,但是super用户已经授权成功了

(postgres@[local]:5432)-[mydb]-#grant all privileges on schema PUBLIC to readonly;
GRANT
postgres 用户再mydb 中已经授权成功了

(readonly@[local]:5432)-[mydb]->select * from information_schema.usage_privileges where grantee=’readonly’;
grantor | grantee | object_catalog | object_schema | object_name | object_type | privilege_type | is_g
rantable

————-+————-+————————+———————-+——————-+——————-+————————+——-

(0 rows)
用户readonly 再mydb 中查询 但是没有数据,请问哪里错了呢?

pg—10的版本

我来答
添加附件
收藏
分享
问题补充
1条回答
默认
最新
周波

  information_schema.usage_privileges系统视图当前仅会记录排序规则、域、外部数据包装器、外部服务器和序列的usage权限授权信息,你的授权语句为为readonly用户授予public模式的所有权限(针对模式的权限有:usage、create),不在该系统视图的记录范围之内,故无法通过该系统视图查看到已授权信息。
  你可以通过pg_namespace中的nspacl属性获取到你刚刚授予的权限信息:

select nspname,nspacl from pg_namespace where nspname = 'public';
复制

  如果你想正确观察information_shcema.usage_privileges的行为,应该授予相关对象的usage权限给其他用户,然后再来观察该视图信息,例如:假设public模式下存在序列seq1,通过如下语句授予序列seq1的usage权限给用户readonly,该授权信息即可正常记录到usage_privileges视图中:

grant usage on sequence public.seq1 to readonly;

-- 执行如下命令即可查到记录信息
select * from information_schema.usage_privileges where grantee='readonly';

复制
暂无图片 评论
暂无图片 有用 4
打赏 0
回答交流
Markdown


请输入正文
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
暂无图片墨值悬赏