Wednesday, April 8, 2020

[google-cloud-sql-discuss] Re: Cannot delete created role (Postgres 11)

Hi,

As the error message clearly denotes, the reason you cannot delete the user is because that user has objects that depend on it. You first need to drop those objects or reassign them to other user. This thread on Stack Exchange discuss how to find the objects owned by the user. As explained in this Stack Overflow thread, you may try to revoke all the possible privileges with multiple statements like:

REASSIGN OWNED BY observer TO postgres;  -- or TO user
DROP OWNED BY observer;
REVOKE ALL PRIVILEGES ON ALL TABLES IN SCHEMA public FROM observer;
REVOKE ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public FROM observer;
REVOKE ALL PRIVILEGES ON ALL FUNCTIONS IN SCHEMA public FROM observer;
DROP USER observer;

In order to be able to run those commands, you will need to connect to the instance first. Hope this resolves the issue? 

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/8731eaaa-2f23-436d-b9e8-17e9fc041110%40googlegroups.com.

No comments:

Post a Comment