Search Postgresql Archives

Re: ddl_command_end not firing DROP events

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux