Re: Event trigger and CREATE/ALTER ROLE/USER

From: Craig Ringer <craig(dot)ringer(at)2ndquadrant(dot)com>
To: Álvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Event trigger and CREATE/ALTER ROLE/USER
Date: 2016-09-14 01:48:46
Message-ID: CAMsr+YGo4d4cChjGi5HLoFmL-e2ZnHKoPthG8gHeXG7A6FfOkA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 14 Sep. 2016 9:44 am, "Alvaro Herrera" <alvherre(at)2ndquadrant(dot)com> wrote:
>
> Tatsuo Ishii wrote:
> > Simple question: Is there any reason for event trigger to not support
> > CREATE/ALTER ROLE/USER?
>
> As I understand the issue, the main reason is that event triggers
> execute procedures, and those exist in a single database only. If you
> were to create an event trigger in database A, then a user gets created
> in database B, your function would not be invoked, which becomes a
> problem.

Yeah... You'd need something at the C level as a hook because you can't
rely on pg_proc etc.

For BDR I've been thinking of optionally replicating such actions using a
ProcessUtility_hook and deparse or simply verbatim sql capture. Then
replicating via generic logical wal messages.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2016-09-14 02:09:57 Re: Event trigger and CREATE/ALTER ROLE/USER
Previous Message Alvaro Herrera 2016-09-14 01:42:47 Re: Event trigger and CREATE/ALTER ROLE/USER