1、以表为单位,查询每个表具有什么权限

select s.*,(select tbl_name from tbls where tbl_id=s.tbl_id) tbl_name,(select name from dbs where db_id=(select db_id from tbls where tbl_id=s.tbl_id)) db_name from (select principal_name,principal_type,tbl_id,string_agg(tbl_priv,',') from tbl_privs group by principal_name,principal_type,tbl_id) s;

2、以账号为单位,查询每隔账号有哪些表的权限

select PRINCIPAL_NAME,PRINCIPAL_TYPE,substr(string_agg(db_name||'.'||tbl_name,','),1,100)m from (select s.*,(select tbl_name from tbls where tbl_id=s.tbl_id) tbl_name,(select name from dbs where db_id=(select db_id from tbls where tbl_id=s.tbl_id)) db_name from (select principal_name,principal_type,tbl_id from tbl_privs group by principal_name,principal_type,tbl_id) s)tt group by PRINCIPAL_NAME,PRINCIPAL_TYPE ;

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐