postgresql-【运维相关】删用户

2022/6/15 2:52:14

本文主要是介绍postgresql-【运维相关】删用户,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

删除用户,用户拥有对象或权限

db1=# drop role user1;
ERROR:  role "user1" cannot be dropped because some objects depend on it
DETAIL:  privileges for column oid of table pg_proc
privileges for column proname of table pg_proc
......

方法一:权限转移

db1=# REASSIGN OWNED BY user1 TO user4;
REASSIGN OWNED

方法二:删除所有依赖此用户的对象、权限

db1=# drop OWNED BY user1;
DROP OWNED

方法三:回收权限

revoke ALL ON ALL TABLES in schema public FROM user1;
revoke ALL ON ALL FUNCTIONS in schema public FROM user1;
revoke ALL ON ALL SEQUENCES in schema public FROM user1;

拓展一点点~~

1、删之前最好nologin一段时间

2、删之前确认下此用户下有哪些表:

pg_tables where  tableowner = ''

3、有哪些权限:

information_schema.table_privileges


这篇关于postgresql-【运维相关】删用户的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程