Re: missing event trigger support functions in 9.3
От | Misa Simic |
---|---|
Тема | Re: missing event trigger support functions in 9.3 |
Дата | |
Msg-id | CAH3i69kGJEv69UQ=QoD8USRk4mKsmDYHosdMJxB0AoggY7gQig@mail.gmail.com обсуждение исходный текст |
Ответ на | missing event trigger support functions in 9.3 (Pavel Stehule <pavel.stehule@gmail.com>) |
Список | pgsql-hackers |
2013/5/9 Pavel Stehule <pavel.stehule@gmail.com>
RegardsHelloI am expecting so this function should not be too complex - and can be moved to contrib maybe (if it is too late now).
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?
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
В списке pgsql-hackers по дате отправления: