From 46651ce6fe013220ed397add242004d764fc0153 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 14:15:05 +0200 Subject: Adding upstream version 14.5. Signed-off-by: Daniel Baumann --- doc/src/sgml/html/pltcl-event-trigger.html | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 doc/src/sgml/html/pltcl-event-trigger.html (limited to 'doc/src/sgml/html/pltcl-event-trigger.html') diff --git a/doc/src/sgml/html/pltcl-event-trigger.html b/doc/src/sgml/html/pltcl-event-trigger.html new file mode 100644 index 0000000..b8d5f15 --- /dev/null +++ b/doc/src/sgml/html/pltcl-event-trigger.html @@ -0,0 +1,30 @@ + +44.7. Event Trigger Functions in PL/Tcl

44.7. Event Trigger Functions in PL/Tcl

+ Event trigger functions can be written in PL/Tcl. + PostgreSQL requires that a function that is + to be called as an event trigger must be declared as a function with no + arguments and a return type of event_trigger. +

+ The information from the trigger manager is passed to the function body + in the following variables: + +

$TG_event

+ The name of the event the trigger is fired for. +

$TG_tag

+ The command tag for which the trigger is fired. +

+

+ The return value of the trigger function is ignored. +

+ Here's a little example event trigger function that simply raises + a NOTICE message each time a supported command is + executed: + +

+CREATE OR REPLACE FUNCTION tclsnitch() RETURNS event_trigger AS $$
+  elog NOTICE "tclsnitch: $TG_event $TG_tag"
+$$ LANGUAGE pltcl;
+
+CREATE EVENT TRIGGER tcl_a_snitch ON ddl_command_start EXECUTE FUNCTION tclsnitch();
+

+

\ No newline at end of file -- cgit v1.2.3