2

I am unable to drop user as I am getting default privileges error.

postgres=# drop user xyz;ERROR: role "xyz" cannot be dropped because some objects depend on itDETAIL: owner of default privileges on new functions belonging to role xyz

then I checked default privileges in database,

 postgres=# \ddpDefault access privilegesOwner | Schema | Type     | Access privileges---- -+------- +----------+-------xyz   |        | function |

Could you please let me know how to revoke this default privileges?

Erwin Brandstetter's user avatar
Erwin Brandstetter
187k28 gold badges467 silver badges644 bronze badges
askedMar 9, 2022 at 11:56
Adam Mulla's user avatar

2 Answers2

4

You have to grant the “default” default privileges:

ALTER DEFAULT PRIVILEGES FOR ROLE xyz GRANT EXECUTE ON FUNCTIONS TO PUBLIC;ALTER DEFAULT PRIVILEGES FOR ROLE xyz GRANT EXECUTE ON FUNCTIONS TO xyz;

Then you should be able to drop the role.

answeredMar 9, 2022 at 12:05
Laurenz Albe's user avatar
0
1

This is the safe sequence of commands to drop a role:

Run in every involved database of the DB cluster.

REASSIGN OWNED BY xyz TO postgres;DROP OWNED BY xyz;

DROP OWNED also gets rid of all privileges and default privileges!

Finally:

DROP ROLE xyz;

More detailed explanation:

answeredMar 10, 2022 at 5:25
Erwin Brandstetter's user avatar

Your Answer

Sign up orlog in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

By clicking “Post Your Answer”, you agree to ourterms of service and acknowledge you have read ourprivacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.