2 42.7. Event Trigger Functions in PL/Tcl #
4 Event trigger functions can be written in PL/Tcl. PostgreSQL requires
5 that a function that is to be called as an event trigger must be
6 declared as a function with no arguments and a return type of
9 The information from the trigger manager is passed to the function body
10 in the following variables:
13 The name of the event the trigger is fired for.
16 The command tag for which the trigger is fired.
18 The return value of the trigger function is ignored.
20 Here's a little example event trigger function that simply raises a
21 NOTICE message each time a supported command is executed:
22 CREATE OR REPLACE FUNCTION tclsnitch() RETURNS event_trigger AS $$
23 elog NOTICE "tclsnitch: $TG_event $TG_tag"
26 CREATE EVENT TRIGGER tcl_a_snitch ON ddl_command_start EXECUTE FUNCTION tclsnitc