有时,我创建了一个名为user1(PostgreSQL 9.4.9)的PostgreSQL用户。
我要删除此用户。因此,我也首先撤销了对表,序列,函数,默认特权和所有权的所有权限:
ALTER DEFAULT PRIVILEGES IN SCHEMA public REVOKE ALL ON SEQUENCES FROM user1;
ALTER DEFAULT PRIVILEGES IN SCHEMA public REVOKE ALL ON TABLES FROM user1;
ALTER DEFAULT PRIVILEGES IN SCHEMA public REVOKE ALL ON FUNCTIONS FROM user1;
REVOKE ALL ON ALL SEQUENCES IN SCHEMA public FROM user1;
REVOKE ALL ON ALL TABLES IN SCHEMA public FROM user1;
REVOKE ALL ON ALL FUNCTIONS IN SCHEMA public FROM user1;
REASSIGN OWNED BY user1 TO postgres;
但是,似乎在两个数据库中一个对象仍然链接到该用户:
postgres=# DROP ROLE user1;
ERROR: role "user1" cannot be dropped because some objects depend on it
DETAIL: 1 object in database db1
1 object in database db2
它甚至似乎是一个函数:
postgres=# \c db1
You are now connected to database "db1" as user "postgres".
db1=# DROP ROLE user1;
ERROR: role "user1" cannot be dropped because some objects depend on it
DETAIL: privileges for function text(boolean)
1 object in database db2
但是我无法确定哪个对象是user1的所有者或与之有关。
如果我pg_dump -s db1 | grep user1
没有结果!可以成为全局对象吗?
如何识别丢失的物体?
我已经在每个数据库(db1和db2)中执行了命令。我不想删除拥有的对象user1
,只想重新分配或删除此用户的授权。