1、查看当前数据库版本
mydb=# select version(); version --------------------------------------------------------------------------------------------------------- PostgreSQL 12.0 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39), 64-bit
2、with子句,查看role和组的关系
with temp as
(select a.rolname,a.rolsuper,m.member from pg_authid a join pg_auth_members m
on a.oid=m.roleid)
select temp.rolname,temp.rolsuper,s.rolname as groupname from temp join pg_authid s
on temp.member = s.oid;
mydb=# with temp as mydb-# (select a.rolname,a.rolsuper,m.member from pg_authid a join pg_auth_members m mydb(# on a.oid=m.roleid) mydb-# select temp.rolname,temp.rolsuper,s.rolname as groupname from temp join pg_authid s mydb-# on temp.member = s.oid; rolname | rolsuper | groupname ----------------------+----------+------------ pg_read_all_settings | f | pg_monitor pg_read_all_stats | f | pg_monitor pg_stat_scan_tables | f | pg_monitor
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。