pg权限相关
1.查看某个表授予的权限
进入到具体的库查询
SELECT grantee,table_schema,table_name,string_agg( privilege_type,', ' ) as privilege_type
FROM information_schema.role_table_grants
WHERE table_name='tb_aa'
group by grantee,table_schema,table_name;
grantee | table_schema | table_name | privilege_type
--------------+--------------+------------+---------------------------------------------------------------
hxl | public | tb_aa | INSERT, SELECT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER
logical_user | public | tb_aa | SELECT
(2 rows)
2.根据用户查询
进入到具体的库查询
SELECT grantee,table_schema,table_name, string_agg( privilege_type,', ' ) as privilege_type
FROM information_schema.role_table_grants
where grantee='hxl' group by table_name,table_schema,grantee;
grantee | table_schema | table_name | privilege_type
--------------+--------------+------------+----------------
logical_user | public | tb_aa | SELECT
logical_user | public | tb_bb | SELECT
logical_user | public | tb_cc | SELECT