PostgreSQL DROP ROLE throws error: cannot drop role because it is required by the database system

Viewed 615

I have a role named service-synapse-postgres and I want to to run DROP ROLE "service-synapse-postgres"; on it. I tried the following commands:

synapse=# REASSIGN OWNED BY "service-synapse-postgres" TO synapse;
ERROR:  cannot reassign ownership of objects owned by role service-synapse-postgres because they are required by the database system
synapse=# DROP OWNED BY "service-synapse-postgres";
ERROR:  cannot drop objects owned by role service-synapse-postgres because they are required by the database system
synapse=# DROP ROLE "service-synapse-postgres";
ERROR:  cannot drop role service-synapse-postgres because it is required by the database system

This is the state of the role service-synapse-postgres:

\du
                          List of roles
         Role name         |       Attributes        | Member of
---------------------------+-------------------------+-----------
 service-synapse-postgres  | Replication, Bypass RLS | {}

What can I do?

1 Answers

You can't drop "service-synapse-postgres" because it appears to be the boot-strap user (the one created by initdb), which is permanent.

The best you could do is probably drop user synapse, then create another superuser account and use it to do alter user "service-synapse-postgres" rename to synapse;

Related