somebase=> REVOKE ALL PRIVILEGES ON DATABASE "somebase" FROM observer;
REVOKE
somebase=> DROP ROLE observer;
ERROR: role "observer" cannot be dropped because some objects depend on it DETAIL: privileges for database somebase
I also
tried to delete it using gcloud cli and CloudSQL console both and failed. So how to delete it now?
Polybius Tech OÜ is a limited liability company registered in Estonia. Registered number: 14420450. Registered office: Tartu mnt. 43, Tallinn 10128, Estonia.
Any information sent by e-mail by Polybius Tech OÜ ("Polybius") or any of its affiliates is confidential and intended solely for the use of the individual or entity to whom it is addressed. If you are not the named addressee you should not disseminate, distribute or copy this email. If you have received this message in error please delete it and any copies of it and notify the sender immediately. Note that the contents of an attachment to this e-mail may contain software viruses, which could damage your computer system. While Polybius has taken every reasonable precaution to minimise this risk, we cannot accept liability for any damage which you sustain as a result of software viruses. You should carry out your own virus checks before opening the attachment.
ERROR: role "observer" cannot be dropped because some objects depend on it
DETAIL: privileges for database somebase
Since the issue seems to be with the connect privilege, this StackOverflow post may be worth reading as it explains how to revoke the connect privilege. That specific privilege seems to be given by default upon some object creation to PUBLIC, which may be why you are having difficulties removing it.
If you are having difficulties with the superuser, you should consider using that user, and keep in mind that you can always change its password in the GCP console.
If the recommendation made in StackOverflow does not help and you still believe that this is a bug, as well as further investigation, I suggest that you make a StackOverflow post yourself to perhaps get some support from other users, as well as create an Issue Tracker entry following instructions.
Because Cloud SQL for PostgreSQL is a managed service, it restricts access to certain system procedures and tables that require advanced privileges. In Cloud SQL, customers cannot create or have access to users with superuser attributes.
Thepostgres
user is part of thecloudsqlsuperuser
role, and has the following attributes (privileges):CREATEROLE
,CREATEDB
, andLOGIN
. It does not have theSUPERUSER
orREPLICATION
attributes.