2017-09-25 10:42 GMT-03:00  <sanyamjai...@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

Reply via email to