Summary

Event triggers are new in PostgreSQL 9.3, and the community is still working on various features in order to make them more useful. You can use these triggers for various purposes, including auditing DDL commands and making local customized policies regarding the execution of DDL commands in the database. Event triggers are disabled in single user mode.

Event triggers are created using the CREATE EVENT TRIGGER command, and they execute a function that returns a special type called EVENT_TRIGGER. There are three types of events that are currently supported: ddl_command_start, ddl_command_end, and sql_drop. You can limit a trigger execution by a tag using a WHEN clause, if you want to fire it for specific commands only.

Currently, there are ...

Get PostgreSQL Server Programming - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.