Since directly modifying Tableau's workgroup database in PostgreSQL is not supported, it's not likely you'll get tons of help here. I'd suggest you hit a PostGreSQL discussion group with this question - you'll probably get more traction.
I have to ask why you are doing this. Permissions cannot be managed by code alone, or worse trying to do a back-end sql update to the permission schema. First of all, you can't simply write a trigger to update the table 'next_gen_permissions' because it has a cascading relationship to many other tables. I'm thinking that you're probably put in a position where there isn't any governance or procedure but messing with the repository database has a bigger risk and isn't the answer. Work out a top-down design in your Tableau site: create Sites, then create Projects, then create Groups that you assign at the Project level or the Workbook level within Projects. Allow some projects to be user-managed, and some to be under change control. Let the organizational hierarchy enforce the security requirements but do your audits to show non-conformance, and eventually you'll establish a culture where hacking the repository workgroup database isn't the answer.