Thread: how drop a role that owns stuff ?

how drop a role that owns stuff ?

From
Andreas
Date:
Hi,
for some cleaning up I'd like to drop a certain role.
Now DROP ROLE yields an error and complains about 271 objects being
owned by this role.

Is there an easy way to switch ownership of those objects to another role?

At least, is there a way to store those dependencies as a file?
The contents of the 4th tab of the role-object in pgAdmin would be nice
but I cant save it or copy it out.
It lists which objects depend on the role.


regards ...

Re: how drop a role that owns stuff ?

From
Alvaro Herrera
Date:
Andreas wrote:
> Hi,
> for some cleaning up I'd like to drop a certain role.
> Now DROP ROLE yields an error and complains about 271 objects being
> owned by this role.
>
> Is there an easy way to switch ownership of those objects to another role?

Yes, see REASSIGN OWNED (gives ownership to something else) and DROP
OWNED (drops grants and removes objects owned).  Normally you run both
in that order.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.