当前位置: 代码迷 >> 综合 >> postgres 授权
  详细解决方案

postgres 授权

热度:34   发布时间:2023-10-22 00:17:23.0

关闭数据库所有连接

SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname='数据库名' AND pid<>pg_backend_pid(); 

授权数据库

grant all on database basiclawdev to fescorocktest;

授权schema

grant usage on schema "basiclaw" to fescorocktest; 

授权所有表

grant all on all tables in schema "basiclaw" to fescorocktest;  

授权所有序列

grant ALL PRIVILEGES ON ALL SEQUENCES  in schema "basiclaw" to fescorocktest;  

 

撤销授权数据库
revoke all on database basiclawdev from fescorocktest;

撤销授权schema
revoke usage on schema "basiclaw" from fescorocktest; 

撤销授权所有表
revoke all on all tables in schema "basiclaw" from fescorocktest;  

撤销授权所有序列

revoke ALL PRIVILEGES ON ALL SEQUENCES  in schema "basiclaw" from fescorocktest;