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 CANu8Fiz0-2skKkYiy915bHSC63795Gaqr7v7yCmCK+11JQ__ww@mail.gmail.com
Whole thread Raw
In response to Re: How to drop user if objects depend on it  (Adrian Klaver <adrian.klaver@aklaver.com>)
Responses Re: How to drop user if objects depend on it  ("Andrus" <kobruleht2@hot.ee>)
List pgsql-general
Can you connect as user postgres? IE: psql -U postgres -d <yourdb>

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

On Wed, Oct 7, 2015 at 9:53 AM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
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


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



--
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: Adrian Klaver
Date:
Subject: Re: How to drop user if objects depend on it
Next
From: "Andrus"
Date:
Subject: Re: How to drop user if objects depend on it