Обсуждение: Create roles trigger

Поиск
Список
Период
Сортировка

Create roles trigger

От
Александр Аникин
Дата:

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.