postgresqlwith子句
1、查看当前数据库版本
创新互联主要从事成都做网站、成都网站制作、成都外贸网站建设、网页设计、企业做网站、公司建网站等业务。立足成都服务海盐,十年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:18982081108
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
网站标题:postgresqlwith子句
本文来源:http://azwzsj.com/article/gdihie.html