Share via

Cannot Drop Role with "Replication" Attribute in Azure PostgreSQL Flexible Server 16

Gabriel Aquino 0 Reputation points
2025-03-06T19:29:17.0533333+00:00

Hello,

I am encountering the following error when trying to drop a role that has the "REPLICATION" attribute enabled.

ERROR: permission denied to drop role
Detail: Only roles with the CREATEROLE attribute and the ADMIN option on role "test_replication" may drop this role.
SQL Error [42501]: ERROR: permission denied to drop role
Detail: Only roles with the CREATEROLE attribute and the ADMIN option on role "test_replication" may drop this role.

Some context:

Environment: Azure Database for PostgreSQL Flexible Server (version 16.8)

Authentication: PostgreSQL authentication only

This "admin" user created the role test_replication but is unable to drop it.

To investigate, we ran the following script:

DROP ROLE IF EXISTS test_noreplication;  

CREATE ROLE test_noreplication WITH  
LOGIN  
NOSUPERUSER  
INHERIT  
CREATEDB  
NOCREATEROLE  
NOREPLICATION;  

DROP ROLE IF EXISTS test_replication;  

CREATE ROLE test_replication WITH  
LOGIN  
NOSUPERUSER  
INHERIT  
CREATEDB  
NOCREATEROLE  
REPLICATION;  

After running the script, we confirmed that we cannot drop the role that has the REPLICATION attribute enabled.

Thanks! Looking forward to your insights.

Azure Database for PostgreSQL

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.