具有默认权限的 PostgreSQL 删除角色
PostgreSQL drop role with default privileges
我正试图放弃一个角色,并切断了我能找到的所有与它的联系,但有一个挥之不去的问题我无法解决。当我 运行 这个:
drop role hank
它告诉我:
ERROR: role "hank" cannot be dropped because some objects depend on it
DETAIL: privileges for default privileges on new functions belonging to role brandon in schema alteryx
privileges for default privileges on new relations belonging to role brandon in schema alteryx
此 DDL 存在于架构中:
ALTER DEFAULT PRIVILEGES IN SCHEMA alteryx
GRANT INSERT, SELECT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER ON TABLES
TO hank;
ALTER DEFAULT PRIVILEGES IN SCHEMA alteryx
GRANT EXECUTE ON FUNCTIONS TO hank;
当我对它们执行 revoke
时,命令成功,但权限保持不变。
我已经搜索了 DDL,但无法找到如何在不尝试 drop-cascade 的情况下解决这个问题。
欢迎任何指导。
您必须运行以下两个语句来摆脱阻止您的默认权限:
ALTER DEFAULT PRIVILEGES FOR ROLE brandon IN SCHEMA alteryx
REVOKE ALL ON TABLES FROM hank;
ALTER DEFAULT PRIVILEGES FOR ROLE brandon IN SCHEMA alteryx
REVOKE ALL ON FUNCTIONS FROM hank;
我正试图放弃一个角色,并切断了我能找到的所有与它的联系,但有一个挥之不去的问题我无法解决。当我 运行 这个:
drop role hank
它告诉我:
ERROR: role "hank" cannot be dropped because some objects depend on it
DETAIL: privileges for default privileges on new functions belonging to role brandon in schema alteryx
privileges for default privileges on new relations belonging to role brandon in schema alteryx
此 DDL 存在于架构中:
ALTER DEFAULT PRIVILEGES IN SCHEMA alteryx
GRANT INSERT, SELECT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER ON TABLES
TO hank;
ALTER DEFAULT PRIVILEGES IN SCHEMA alteryx
GRANT EXECUTE ON FUNCTIONS TO hank;
当我对它们执行 revoke
时,命令成功,但权限保持不变。
我已经搜索了 DDL,但无法找到如何在不尝试 drop-cascade 的情况下解决这个问题。
欢迎任何指导。
您必须运行以下两个语句来摆脱阻止您的默认权限:
ALTER DEFAULT PRIVILEGES FOR ROLE brandon IN SCHEMA alteryx
REVOKE ALL ON TABLES FROM hank;
ALTER DEFAULT PRIVILEGES FOR ROLE brandon IN SCHEMA alteryx
REVOKE ALL ON FUNCTIONS FROM hank;