Weeks ago when I was learning PostgreSQL security, I was trying to do some strange things (although not recommended) to remove the public schema from the object browser in pgadmin. Luckily I have all the commands I ran and all of the undo commands I ran, but I still seem to have one role object that I'm unable to drop. I'm getting an error when trying to DROP ROLE test_role_11, but I still seem to have object dependencies in the public schema. Can you help me find the query to find out what it is? Can you also help me find the correct REVOKE command (or other) to undo the dependencies and/or privileges, given the first query? PUBLIC seems to be its own challenge and not an actual role, so I'm not sure how to write the query. I've tried using old questions, but didn't get very far.
Exception/Error:
role "test_role_11" cannot be dropped because some objects depend on it DETAIL: privileges for schema public
Here are the queries I ran.
CREATE ROLE test_role_11
--NOSUPERUSER NOCREATEDB NOCREATEROLE NOINHERIT NOLOGIN NOREPLICATION NOBYPASSRLS
REVOKE ALL ON ALL TABLES IN SCHEMA pg_catalog FROM public, me;
--GRANT ALL ON ALL TABLES IN SCHEMA pg_catalog TO public, me;
GRANT SELECT ON ALL TABLES IN SCHEMA pg_catalog TO test_role_11;
--REVOKE SELECT ON ALL TABLES IN SCHEMA pg_catalog FROM test_role_11;
GRANT test_role_11 TO me
--REVOKE object_browser FROM me;
--GRANT SELECT ON TABLE aaa IN SCHEMA pg_catalog TO test_role_11;
GRANT SELECT ON TABLE pg_catalog."aaa" TO test_role_11;
GRANT SELECT ON TABLE staging."aaa" TO test_role_11;
GRANT SELECT ON TABLE pg_database TO test_role_11;
These did not find any object dependencies for my role.
Find objects linked to a PostgreSQL role