问题描述
当我尝试在我们的 PG 实例 (11.10) 中删除一个用户时,我有一个奇怪的行为。我看过其他帖子。但是,他们都没有解决我的问题。
我们有以下用户,之前被授予了 1 dB 的访问权限
# \c my_db
# \ddp+
Default access privileges
Owner | Schema | Type | Access privileges
--------------+--------+----------+------------------------------------------------------
fdovy1a969c6 | | function |
fdovy1a969c6 | | schema |
fdovy1a969c6 | | sequence |
fdovy1a969c6 | | table |
fdovy1a969c6 | | type |
...
在达到此状态之前,我们运行以下内容
# reassign owned by fdovy1a969c6 to other_user;
# ALTER DEFAULT PRIVILEGES FOR ROLE fdovy1a969c6 in schema public REVOKE ALL ON FUNCTIONS FROM public;
# ALTER DEFAULT PRIVILEGES FOR ROLE fdovy1a969c6 REVOKE EXECUTE ON FUNCTIONS FROM public;
如果我们尝试运行 drop 用户,我们会得到以下结果:
# drop role fdovy1a969c6;
ERROR: role "fdovy1a969c6" cannot be dropped because some objects depend on it
DETAIL: owner of default privileges on new relations belonging to role fdovy1a969c6
owner of default privileges on new schemas belonging to role fdovy1a969c6
owner of default privileges on new functions belonging to role fdovy1a969c6
owner of default privileges on new types belonging to role fdovy1a969c6
owner of default privileges on new sequences belonging to role fdovy1a969c6
我们的问题是为什么我们会为这个用户提供一种空条目作为 \ddp+ 的结果?
drop owned by
命令可能会删除此用户。但是,我不太有信心运行这个命令,因为它也会删除拥有的对象......而且我不完全了解它当前拥有的对象是什么。
感谢您的任何提示 何塞
解决方法
您已为该用户设置了默认权限,可以撤消包括所有者在内的所有人对所有对象的所有权限。
要撤消该操作,请授予相应的默认权限。例如,去掉函数入口:
body{
font-family: 'Montserrat',sans-serif;
}
#title{
padding: 3% 15%;
background-color: #ff4c68;
font-family: 'Montserrat',sans-serif;
color: #ffffff;
}
.navbar-brand{
font-family: 'Ubuntu',sans-serif;
font-weight: bold;
font-size: 2.5rem !important;
}
.cat-profile
{
transform: rotate(10deg);
width: 360px;
margin-top: 20px;
}
.download-button{
margin-top: 20px;
}
.title-things{
margin-top: 100px ;
}
.title-container {
padding: 0% 15%;
}
/* .col{
padding: 0px;
} */
/* .title-text
{
font-family: 'Montserrat',sans-serif;
font-weight: bold;
size : 3rem;
line-height: 1.5;
} */
您必须对所有对象类型执行类似的操作。