Re: missing event trigger support functions in 9.3

From: Misa Simic <misa(dot)simic(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: missing event trigger support functions in 9.3
Date: 2013-05-09 18:33:40
Message-ID: CAH3i69kGJEv69UQ=QoD8USRk4mKsmDYHosdMJxB0AoggY7gQig@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2013/5/9 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Darren Duncan 2013-05-09 18:52:54 Re: missing event trigger support functions in 9.3
Previous Message Alvaro Herrera 2013-05-09 18:22:42 Re: missing event trigger support functions in 9.3