marijnh / Postmodern

A Common Lisp PostgreSQL programming interface
http://marijnhaverbeke.nl/postmodern
Other
400 stars 90 forks source link

Minor enhancement for drop-role if role postgres does not exist #308

Closed sabracrolleton closed 2 years ago

sabracrolleton commented 2 years ago

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.