Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redshift - user "xyz" cannot be dropped because the user owns some object

When trying to drop a user "xyz" in a Redshift database, I get the error message:

user 'xyz' cannot be dropped because the user owns some object.

According to the documentation:

If a user owns an object, first drop the object or change its ownership to another user before dropping the original user

How do I know which objects (schemas, tables, views, UDFs?, ...) are owned by the user?

like image 835
MiguelPeralvo Avatar asked Dec 11 '22 19:12

MiguelPeralvo


1 Answers

In my case, the user didn't own any tables or views or anything else that I could find. I guessed correctly that having been granted a privilege meant the user "owned" something, because I fixed the problem with this:

revoke all privileges on database some_database_name from some_user_name

after which the drop user command worked.

like image 160
Bohemian Avatar answered Jan 14 '23 04:01

Bohemian