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 @ 2023-09-19 16:36  站着说话不腰疼  阅读(466)  评论(0)    收藏  举报