unable to drop user in PostgreSQL 12.4



  • I am unable to drop user as I am getting default privileges error.

    postgres=# drop user xyz;
    ERROR: role "xyz" cannot be dropped because some objects depend on it
    DETAIL: owner of default privileges on new functions belonging to role xyz
    

    then I checked default privileges in database,

     postgres=# \ddp
    Default access privileges
    Owner | Schema | Type     | Access privileges
    ---- -+------- +----------+-------
    xyz   |        | function |
    

    Could you please let me know how to revoke this default privileges?



  • You have to grant the “default” default privileges:

    ALTER DEFAULT PRIVILEGES FOR ROLE xyz GRANT EXECUTE ON FUNCTIONS TO PUBLIC;
    ALTER DEFAULT PRIVILEGES FOR ROLE xyz GRANT EXECUTE ON FUNCTIONS TO xyz;
    

    Then you should be able to drop the role.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2