4、postgres授权给其他用户

postgres授权给其他用户

1、授权

在授权前,需要先执行schema的使用授权,不然授权无效

grant usage on schema user_1 to user_2;
GRANT SELECT ON TABLE user_1.t_conf_table TO user_2;

2、查询指定表的授权

SELECT * FROM information_schema.table_privileges WHERE table_name = 'your_table_name';

联合使用:

SELECT 'grant usage on schema '||table_schema||' to '||grantee||';
GRANT '||privilege_type||' ON TABLE '||table_schema||'.'||table_name||' TO '||grantee||';
' FROM information_schema.table_privileges WHERE table_name like 'bpl_%'
and grantee <> 'readonly';
posted @   站着说话不腰疼  阅读(398)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
点击右上角即可分享
微信分享提示