'tuple concurrently updated' error when granting permissions
We have a problem with GRANT CREATE ON DATABASE commands to haf apps. When apps are installed concurrently, they run concurrent psql sessions. These particular GRANT commands all modify the same row and can lead to a tuple concurrently updated error. I found more info on this problem here: https://www.postgresql.org/message-id/flat/CAFoTioX5gRjxf927ysQTRarP0rQOk4Wkp1exAtLDiqMK0Pg2jw%40mail.gmail.com
Based on the above link, the simplest solution appears to be to create a single role that has this privilege, then give membership to that role (via the normal GRANT role to role commands) as these memberships are implemented as separate rows and don't lead to a tuple conflict. The other option would be to setup some locking mechanism, but it seems the membership method is the preferred method (and also simpler).
Note this is actually a meta-issue as it requires changes to all HAF app repos.