databasepostgresqltriggersdifferenceeventtrigger

Trigger vs Event Trigger in PostgreSQL


I am a beginner of learning trigger, I found that there have Trigger and Event Trigger in Postgresql, I want to know what's the difference between Trigger and Event Trigger? And what's the application scenario of them?


Solution

  • A ("traditional") trigger is fired by DML statements: INSERT, DELETE, UPDATE

    An event trigger is fired for DDL statements: create table, drop table or similar statements.

    So the first catches changes to the data, the second catches changes to the data definition