Dropping role in PostgresSQL

I am having the same issue dropping a role. Did so much research on google but no help.

SQL Error [2BP01]: ERROR: role "readonly" cannot be dropped because some objects depend on it Detail: privileges for default privileges on new relations belonging to role rohit in schema public

Here is what I did to drop role readonly.

REVOKE USAGE ON SCHEMA public FROM readonly;
REVOKE ALL ON SCHEMA public FROM readonly;


REVOKE ALL PRIVILEGES ON ALL TABLES IN SCHEMA public FROM readonly;
REVOKE ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public FROM readonly;
REVOKE ALL PRIVILEGES ON ALL FUNCTIONS IN SCHEMA public FROM readonly;

  
REVOKE CONNECT ON DATABASE kozuchi_db FROM readonly;
REVOKE CONNECT ON DATABASE parc_prod FROM readonly;
REVOKE CONNECT ON DATABASE postgres FROM readonly;


DROP USER readonly;


Read more here: https://stackoverflow.com/questions/65709440/dropping-role-in-postgressql

Content Attribution

This content was originally published by SQLSERVERDAWG at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: