Re: [DOCS] drop table doesn't fire ddl_command_end event trigger

Поиск
Список
Период
Сортировка
От Euler Taveira
Тема Re: [DOCS] drop table doesn't fire ddl_command_end event trigger
Дата
Msg-id CAHE3wgjX-N=X9mccp4Bs-y-=HE=qayHEpXpCs1jMT=W0ZsYc5A@mail.gmail.com
обсуждение исходный текст
Ответ на [DOCS] drop table doesn't fire ddl_command_end event trigger  (sanyamjain22@live.in)
Список pgsql-docs
2017-09-25 10:42 GMT-03:00  <sanyamjain22@live.in>:
> I have enable ddl_command_end trigger on a table.I can see fired events when
> ddl type is alter or create but drop is not catched. But in description
> https://www.postgresql.org/docs/9.6/static/event-trigger-matrix.html
> it is mentioned that drop table will also generate ddl_command_end trigger.
>
You don't show a test case. It works for me.

--
-- Extracted from manual [1]
--
CREATE FUNCTION test_event_trigger_for_drops()       RETURNS event_trigger LANGUAGE plpgsql AS $$
DECLARE   obj record;
BEGIN   FOR obj IN SELECT * FROM pg_event_trigger_dropped_objects()   LOOP       RAISE NOTICE '% dropped object: % %.%
%',                   tg_tag,                    obj.object_type,                    obj.schema_name,
obj.object_name,                    obj.object_identity;   END LOOP;
 
END
$$;
CREATE EVENT TRIGGER test_event_trigger_for_drops  ON sql_drop  EXECUTE PROCEDURE test_event_trigger_for_drops();


$ psql
psql (9.6.2)
Digite "help" para ajuda.

euler=# CREATE TYPE foo AS (f1 int, f2 text);
CREATE TYPE
euler=# drop type foo;
NOTICE:  DROP TYPE dropped object: type public.foo public.foo
NOTICE:  DROP TYPE dropped object: composite type public.foo public.foo
NOTICE:  DROP TYPE dropped object: type public._foo public.foo[]
DROP TYPE


[1] https://www.postgresql.org/docs/9.6/static/functions-event-triggers.html


--   Euler Taveira                                   Timbira -
http://www.timbira.com.br/  PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento


-- 
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs

В списке pgsql-docs по дате отправления:

Предыдущее
От: lisael@lisael.org
Дата:
Сообщение: [DOCS] add details in trigger's infinite recursion warnings
Следующее
От: Jaime Casanova
Дата:
Сообщение: Re: [DOCS] "Comparison of Different Solutions"