In order to drop a role, you need to reassign ownership of any database objects it might own. The drop-role function takes an optional second parameter specifying where to reassign ownership. If that parameter is not provided, normal practice has been to reassign ownership to the default base role 'postgres'.
Some cloud setups do not give access to the 'postgres' role or it has been removed, so it cannot be used for this purpose. This change will assign the ownership rights to the role calling the drop-role function if the value of the new-owner parameter does not actually exist as a role.
In order to drop a role, you need to reassign ownership of any database objects it might own. The drop-role function takes an optional second parameter specifying where to reassign ownership. If that parameter is not provided, normal practice has been to reassign ownership to the default base role 'postgres'.
Some cloud setups do not give access to the 'postgres' role or it has been removed, so it cannot be used for this purpose. This change will assign the ownership rights to the role calling the drop-role function if the value of the new-owner parameter does not actually exist as a role.