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

From Adrian Klaver
Subject Re: How to drop user if objects depend on it
Date
Msg-id 561523C2.4040309@aklaver.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  (Melvin Davidson <melvin6925@gmail.com>)
Re: How to drop user if objects depend on it  ("Andrus" <kobruleht2@hot.ee>)
List pgsql-general
On 10/07/2015 05:12 AM, Andrus wrote:
> Hi!
>
>> The objects can't be owned by nothing, so you will need to reassign
>> ownership:
>> REASSIGN OWNED BY old_role TO new_role;
>> e.g.
>> REASSIGN OWNED BY vantaa TO postgres;
>> Then you can drop the role.
>
> User who deletes other users is not superuser. It is created using
>
> CREATE ROLE admin LOGIN
>   NOSUPERUSER INHERIT CREATEDB CREATEROLE NOREPLICATION CONNECTION LIMIT
> 100;
> GRANT idd_owner TO admin;
>
>
> I tried

So to be clear admin is doing the below, correct?

>
> REASSIGN OWNED BY vantaa TO postgres;
>
> and
>
> REASSIGN OWNED BY vantaa TO idd_owner;
>
> but got  error
>
> permission denied to reassign objects .

Is the above a blanket error or does it mention specific objects?

>
> How to fix ?

What you are trying to do is reverse what you did to get the present
setup. Do you have a record/script that shows what you did to create the
role and assign it to the objects?

>
> I can add some rights to user who invokes this command if this helps.
>
> Andrus.
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Issues with german locale on CentOS 5,6,7
Next
From: Melvin Davidson
Date:
Subject: Re: How to drop user if objects depend on it