PostgresDB 01006: Privilege Not Revoked

Privilege was not revoked.

When a user encounters the message <Cell R15C1 '01006: Privilege Not Revoked'> from PostgresDB, the recommended action involves investigating why the privilege revocation failed, as this message indicates an attempt to revoke one or more privileges from a user, role, or group that was unsuccessful. Here are the steps a user should take:

  1. Identify the Privilege and Role/User: First, understand which privilege was attempted to be revoked and from which user or role. Use the query:
  2. SELECT grantee, privilege_type
    FROM information_schema.role_table_grants
    WHERE table_name='your_table_name';
  3. Check Current Privileges: Verify the current privileges of the user or role to understand if the privilege was indeed not revoked or if there was another issue. You can check privileges by running:
  4. \dp your_table_name
  5. or for a more detailed view:
  6. SELECT * FROM information_schema.table_privileges
    WHERE grantee='your_role_or_user';
  7. Review Dependency Objects: Sometimes, privileges cannot be revoked because they are required by other database objects or roles that depend on them. Check for any dependencies that might prevent the privilege from being revoked:
  8. SELECT dependent_obj.*
    FROM pg_depend
    JOIN pg_class dependent_obj ON pg_depend.objid = dependent_obj.oid
    JOIN pg_authid ON pg_depend.refobjid = pg_authid.oid
    WHERE pg_authid.rolname = 'role_name';
  9. Attempt Revocation Again: If the privilege is still present and no dependencies are blocking its revocation, try to revoke the privilege again using the correct syntax, ensuring to specify the right database, table, and privilege:
  10. REVOKE SELECT ON your_table_name FROM your_role_or_user;
  11. Check for System Errors or Logs: If the privilege still appears not to be revoked, check the PostgreSQL logs for any system errors or warnings that might indicate why the revocation failed. This can provide clues to underlying issues:
  12. tail -f /var/log/postgresql/postgresql-xx-main.log
  13. Consult Documentation or Community: If you're unable to resolve the issue, consult the PostgreSQL documentation or community forums for additional insights. Sometimes, specific versions of PostgreSQL might have nuances that are addressed in documentation or have been encountered by others in the community.
  14. Review Access Control Lists (ACLs): As a last resort, directly examine and edit the Access Control Lists (ACLs) for the database object in question. This is an advanced action and should be done with caution:
  15. SELECT relacl FROM pg_class WHERE relname = 'your_table_name';
  16. This will show the ACLs for the table, and you may manually adjust them if necessary, although this is not recommended without a thorough understanding of PostgreSQL ACLs.

Remember, direct manipulation of system catalogs or ACLs should be done with extreme caution and is generally not recommended unless you have a deep understanding of PostgreSQL internals.

Never debug

PostgresDB

manually again

Let Dr. Droid create custom investigation plans for your infrastructure.

Book Demo
Automate Debugging for
PostgresDB
See how Dr. Droid creates investigation plans for your infrastructure.

MORE ISSUES

Made with ❤️ in Bangalore & San Francisco 🏢

Doctor Droid