Re: ddl_command_end not firing DROP events

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: ddl_command_end not firing DROP events
Дата
Msg-id 20180708181929.ef6nooxn43ppdoqv@alvherre.pgsql
обсуждение исходный текст
Ответ на ddl_command_end not firing DROP events  (Demitri Muna <postgresql@demitri.com>)
Ответы Re: ddl_command_end not firing DROP events
Список pgsql-general
On 2018-Jul-08, Demitri Muna wrote:

Hi

> I’ve created a trigger where I want to capture schema-changing events.
> I’m finding that DROP events are not being triggered when using
> “ddl_command_end". The test case below demonstrates this. I am running
> PostgreSQL 10.4. The trigger is fired for the CREATE event, but not
> DROP TYPE or DROP TABLE.
> 
> I came across the same question on the mailing list, but the solution
> was to use the “sql_drop” trigger instead.
> 
> https://www.postgresql.org/message-id/CAHE3wgjX-N%3DX9mccp4Bs-y-%3DHE%3DqayHEpXpCs1jMT%3DW0ZsYc5A%40mail.gmail.com

As I recall, handling of DROP events in the ddl_command_end event is not
completely consistent. You may even find that some DROP events are not
returned by pg_event_trigger_ddl_commands.  I suggest you stick to
pg_event_trigger_dropped_objects() instead (for which you need
sql_drop).

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


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

Предыдущее
От: Demitri Muna
Дата:
Сообщение: ddl_command_end not firing DROP events
Следующее
От: Paul A Jungwirth
Дата:
Сообщение: Re: User-defined function with anyrange[]