Sal*_*ali 5 permissions redshift
我有一个非常标准的问题,我无法解决。我想在 redshift 中删除一个DROP USER u_A;
返回我的用户:user "u_A" cannot be dropped because the user has a privilege on some object
。
问题是我不知道这是什么特权以及针对什么对象。
在 PostgreSQL 中,我只想REASSIGN OWNED BY u_A TO u_B
在 u_B 是其他用户的地方。问题是 redshift 不支持 REASSIGN。我拥有的表和模式的数量太大(所以我不能随意尝试所有内容,希望在某个时候我会删除所需的特权。
那么如何删除该用户呢?
小智 5
有一些查询可以为您提供当前授予用户对任何对象的权限:
select
nspname as schemaname
, array_to_string(nspacl, ',') as acls
from
pg_namespace
where
nspacl is not null
and nspowner != 1
and array_to_string(nspacl, ',') like '%u_A=%' -- REPLACE USERNAME
;
Run Code Online (Sandbox Code Playgroud)
select
pg_namespace.nspname as schemaname
, pg_class.relname as tablename
, array_to_string(pg_class.relacl, ',') as acls
from pg_class
left join pg_namespace on pg_class.relnamespace = pg_namespace.oid
where
pg_class.relacl is not null
and pg_namespace.nspname not in (
'pg_catalog'
, 'pg_toast'
, 'information_schema'
)
and array_to_string(pg_class.relacl, ',') like '%u_A=%' -- REPLACE USERNAME
order by
pg_namespace.nspname
, pg_class.relname
;
Run Code Online (Sandbox Code Playgroud)
r -- SELECT ("read")
w -- UPDATE ("write")
a -- INSERT ("append")
d -- DELETE
D -- TRUNCATE
x -- REFERENCES
t -- TRIGGER
X -- EXECUTE
U -- USAGE
C -- CREATE
c -- CONNECT
T -- TEMPORARY
arwdDxt -- ALL PRIVILEGES (for tables, varies for other objects)
* -- grant option for preceding privilege
/yyyy -- role that granted this privilege
Run Code Online (Sandbox Code Playgroud)