postgresql删除用户提示ERROR: role postgres1 cannot be dropped because some objects depend on it

Posted 瀚高PG实验室

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了postgresql删除用户提示ERROR: role postgres1 cannot be dropped because some objects depend on it相关的知识,希望对你有一定的参考价值。

作者:瀚高PG实验室 (Highgo PG Lab)- 徐云鹤

删除用户可以使用如下命令:

drop user postgres1;

如果提示如下内容则说明该用户下有所属对象。

postgres=# drop user postgres1 ;
ERROR:  role "postgres1" cannot be dropped because some objects depend on it

需要通过如下两条命令进行删除。

drop owned by postgres1 cascade;
drop user postgres1;

将想删除的用户名替换postgres1即可。
删除前确保连接的数据库正确,执行删除命令前需三思而后行~~
截至PG13,没有 drop user postgres1 cascade;命令。以后应该也不会有。

以上是关于postgresql删除用户提示ERROR: role postgres1 cannot be dropped because some objects depend on it的主要内容,如果未能解决你的问题,请参考以下文章

[Android Pro] root用户删除文件提示:Operation not permitted

gitlab恢复数据出现错误提示:Restoring PostgreSQL database gitlabhq_production ... ERROR: must be owner of exte

gitlab恢复数据出现错误提示:Restoring PostgreSQL database gitlabhq_production ... ERROR: must be owner of exte

postgresql 错误:“返回”处或附近的语法错误

循环中的PostgreSQL DROP TABLE失败,出现ERROR:共享内存

PostgreSQL copy 时提示:ERROR: invalid byte sequence for encoding "UTF8": 0xb3