Re: Completely replacing an old user

From: M Sarwar <sarwarmd02(at)outlook(dot)com>
To: "pgsql-admin(at)lists(dot)postgresql(dot)org" <pgsql-admin(at)lists(dot)postgresql(dot)org>, Koen De Groote <kdg(dot)dev(at)gmail(dot)com>, Pepe TD Vo <pepevo(at)yahoo(dot)com>
Subject: Re: Completely replacing an old user
Date: 2023-09-17 20:04:05
Message-ID: DM4PR19MB5978ED70DB3F6E2CB047A933D3F4A@DM4PR19MB5978.namprd19.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi Pepe,
You are right. It got dropped after revoking the privileges.
Thank you so much,
Sarwar

________________________________
From: Pepe TD Vo <pepevo(at)yahoo(dot)com>
Sent: Saturday, September 16, 2023 6:46 PM
To: pgsql-admin(at)lists(dot)postgresql(dot)org <pgsql-admin(at)lists(dot)postgresql(dot)org>; Koen De Groote <kdg(dot)dev(at)gmail(dot)com>
Subject: Re: Completely replacing an old user

Sound like this is actually an alias for DROP ROLE.

You have to explicitly drop any privileges associated with that user, also to move its ownership to other roles (or drop the object).
reassign owned by <olduser> to <nnewuser> ;
and then
drop owned by <olduser>;
The latter will remove any privileges granted to the user.
https://www.postgresql.org/docs/current/role-removal.html

Bach-Nga

No one in this world is pure and perfect. If you avoid people for their mistakes you will be alone. So judge less, love, and forgive more.[Emoji][Emoji][Emoji]
To call him a dog hardly seems to do him justice though in as much as he had four legs, a tail, and barked, I admit he was, to all outward appearances. But to those who knew him well, he was a perfect gentleman (Hermione Gingold)

**Live simply **Love generously **Care deeply **Speak kindly.
*** Genuinely rich *** Faithful talent *** Sharing success

On Saturday, September 16, 2023 at 02:28:13 PM EDT, Koen De Groote <kdg(dot)dev(at)gmail(dot)com> wrote:

All,

I am trying to set up a new user for a client application, and thus want to remove the old user afterward.

The steps are:

1/ create the new user
2/ give the new user all priviliges on database, table, sequence, function and procedures, just like the old user
3/ deply client application with the new user and credentials
3/ Swap ownership of the databases
4/ Remove privileges from the old user
5/ Drop the old user

But I'm getting stuck on one last error message:

ERROR: role "X" cannot be dropped because some objects depend on it
DETAIL: privileges for default privileges on new functions belonging to role postgres in schema public

The "new functions" bit is confusing. I've swapped over all the current functions, but cannot seem to find the appropriate table for privileges on new functions.

What am I missing here?

Regards,
Koen De Groote

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Rui DeSousa 2023-09-18 03:41:31 Re: Blocking queries on a hot standby?
Previous Message M Sarwar 2023-09-17 18:11:50 Re: Unable to drop the user