Create roles trigger

From: Александр Аникин <anikin24(at)list(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org, pgsql-admin(at)postgresql(dot)org
Cc: borey2005(at)gmail(dot)com
Subject: Create roles trigger
Date: 2018-09-27 09:07:48
Message-ID: 1538039268.772929533@f494.i.mail.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-hackers


Hey, folks!
I've got a question about events on roles creation.
I need to execute some custom logic on role creation.
All information about roles located in `pg_authid` table.
The first thing that comes to mind is to create trigger on `pg_authid` table, but this is not possible, because this is a system table.
Next thing, is to create a view (select * from pg_authid) and create trigger on view, but this didn't work out too.

One more thing is to create event trigger (CREATE EVENT TRIGGER trigger ON ddl_command_start WHEN TAG IN ('CREATE ROLE')), but it's also not possible, event triggers are not supported for 'CREATE ROLE'.
Is there is any possibility to do that ? May be, create custom extension or something else.

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Ferrell, Denise SDC 2018-09-27 12:39:33 Data Corruption Errors
Previous Message Peter Eisentraut 2018-09-25 17:53:49 Re: Reversing pg_logical replication

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2018-09-27 09:12:04 Re: Problem while setting the fpw with SIGHUP
Previous Message Michael Paquier 2018-09-27 08:02:21 Re: Problem while setting the fpw with SIGHUP