Use cases for creating event triggers
In addition to an audit trail, the following can be valid use cases for an event trigger:
- Replicating DDL changes to a remote location
- Cascading a DDL
- Preventing changes to tables, except during a predefined window
- Providing limited DDL capability to developers / support staff using security definer functions
- Disabling certain DDL commands based on a criteria
- Performance analysis to see how long a command takes between
ddl_command_start
andddl_command_end
Note that the event trigger support for PL/pgsql is not yet complete in 9.3. There are several features that are being worked upon and will be available in future PostgreSQL versions, hopefully. These are a few of the most notable features that are missing so far:
- There's no information about the object that a DDL targets
- There's no access to the command string
- There's no support for the generated commands
A command such as CREATE TABLE foo (id serial PRIMARY KEY)
will also result in the CREATE...