Re: How to drop user if objects depend on it - Mailing list pgsql-general

From Melvin Davidson
Subject Re: How to drop user if objects depend on it
Date
Msg-id CANu8FizdtE5ORRfhmgXGMu3e6Re77TX_FNrLb5HMWFRvc7z+Cw@mail.gmail.com
Whole thread Raw
In response to Re: How to drop user if objects depend on it  ("Andrus" <kobruleht2@hot.ee>)
Responses Re: How to drop user if objects depend on it  ("Andrus" <kobruleht2@hot.ee>)
List pgsql-general
No. You need to be a superuser to reassign objects unless you own the object.
You must also be a superuser to drop roles.

So.
1. first connect as user postgres
2. REASSIGN all the tables owned by the missing user first.
3. Then you can drop the missing user AFTER you have reassigned all the objects they own.

On Wed, Oct 7, 2015 at 10:48 AM, Andrus <kobruleht2@hot.ee> wrote:
Hi!

Can you connect as user postgres? IE: psql -U postgres -d <yourdb>

Applicaton has admin users which should be able to delete other users.
Those users dont have superuser rights.

I can connect as user postgres for testing only.
I'm looking for a way to delete users without superuser right.

If so, then you should have the ability to execute the commands without any problem.

I tried in database ktp :

reassign owned by farukkugay to postgres;
drop user farukkugay ;

This causes error

ERROR:  role "farukkugay" cannot be dropped because some objects depend on it
DETAIL:  privileges for schema public

So even superuser cannot delete.

Andrus.



--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.

pgsql-general by date:

Previous
From: "Andrus"
Date:
Subject: Re: How to drop user if objects depend on it
Next
From: Tom Lane
Date:
Subject: Re: How to drop user if objects depend on it