Re: Unable to drop the user

From: M Sarwar <sarwarmd02(at)outlook(dot)com>
To: Erik Wienhold <ewie(at)ewie(dot)name>, "pgsql-admin(at)lists(dot)postgresql(dot)org" <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: Unable to drop the user
Date: 2023-09-17 18:11:50
Message-ID: DM4PR19MB59787343D73976C53853E29BD3F4A@DM4PR19MB5978.namprd19.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Erik,
That did work.
Appreciated!

Thank you,
Sarwar

________________________________
From: Erik Wienhold <ewie(at)ewie(dot)name>
Sent: Sunday, September 17, 2023 12:21 PM
To: M Sarwar <sarwarmd02(at)outlook(dot)com>; pgsql-admin(at)lists(dot)postgresql(dot)org <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: Unable to drop the user

On 17/09/2023 17:26 CEST M Sarwar <sarwarmd02(at)outlook(dot)com> wrote:

> I am trying to drop a user.
>
> drop USER Dev_BaoP ;
>
> I am getting the below error message.
>
> ERROR: role "dev_baop" cannot be dropped because some objects depend on it
> DETAIL: privileges for schema public
> privileges for schema Bronx

You need to revoke those privileges before dropping the role [1]. Use psql
command \dn+ to show them. Or just use the combo of REASSIGN OWNED BY and
DROP OWNED BY.

See also this recent thread [2].

[1] https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.postgresql.org%2Fdocs%2Fcurrent%2Frole-removal.html&data=05%7C01%7C%7Cd4b39ad1b0d74ff6aee908dbb79a1bfe%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638305644772720116%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=M35Tjx8sd9c2GFxYRuBIVY%2FE6ey2NfYPXxQjYWWkqlw%3D&reserved=0<https://www.postgresql.org/docs/current/role-removal.html>
[2] https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.postgresql.org%2Fmessage-id%2FCAGbX52H6XVMzZ96TcyArjOPw2KCUpQ6EC1Ch%253DyPAyUxsL1Qreg%2540mail.gmail.com&data=05%7C01%7C%7Cd4b39ad1b0d74ff6aee908dbb79a1bfe%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638305644772720116%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=IDIwKIkMnm%2F1QJ3F7dpaPTZouFHQCwutulhjBnUOVJY%3D&reserved=0<https://www.postgresql.org/message-id/CAGbX52H6XVMzZ96TcyArjOPw2KCUpQ6EC1Ch%3DyPAyUxsL1Qreg%40mail.gmail.com>

--
Erik

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message M Sarwar 2023-09-17 20:04:05 Re: Completely replacing an old user
Previous Message Erik Wienhold 2023-09-17 16:21:07 Re: Unable to drop the user