2013/5/9 Pavel Stehule <pavel.steh...@gmail.com>

> Hello
>
> I am writing a article about 9.3. I found so event trigger functions is
> not complete. We have only pg_event_trigger_dropped_objects() function. It
> looks really strange and asymmetric. Can we implement similar function for
> CREATE as minimum to 9.3?
>
> I am expecting so this function should not be too complex - and can be
> moved to contrib maybe (if it is too late now).
>
> Regards
>
> Pavel
>


Maybe as workaround can help:

CREATE OR REPLACE FUNCTION snitch() RETURNS event_trigger AS $$
DECLARE
my_cmd text;
BEGIN
    SELECT query FROM pg_stat_activity where pid = pg_backend_pid() INTO
my_cmd;
    RAISE NOTICE 'snitch: % % %', tg_event, tg_tag, my_cmd;
END;
$$ LANGUAGE plpgsql;

CREATE EVENT TRIGGER snitch ON ddl_command_start EXECUTE PROCEDURE snitch();

Then based on tg_tag - you can have different rules to take object_name
from my_cmd - or whatever else is needed for additional rules...

Kind Regards,

Misa

Reply via email to