Site icon Database Tutorials

role “x” cannot be dropped because some objects depend on it

 

If you want to delete the PostgreSQL user, we can get the error “role x can not be dropped because some objects depend on it”. You can find the display of the error below.

 

In order to remove the user without receiving this error, you must first revoke the user authority as follows.

 

Once the authorities have been revoked with the revoke command, run the drop command again.

If you keep getting the same error, you can see the tables with the owner by using the following script.

 

With the help of the command below, you can set the owner of these tables as the postgres user.

Exit mobile version