Event Trigger Dialog¶
Use the Domain Trigger dialog to define an event trigger. Unlike regular triggers, which are attached to a single table and capture only DML events, event triggers are global to a particular database and are capable of capturing DDL events. Like regular triggers, event triggers can be written in any procedural language that includes event trigger support, or in C, but not in SQL.
The Domain Trigger dialog organizes the development of a event trigger through the following dialog tabs: General, Definition, and Security Labels. The SQL tab displays the SQL code generated by dialog selections.
Create Event Trigger dialog - General tab¶
Use the fields in the General tab to identify the event trigger:
Use the
Namefield to add a descriptive name for the event trigger. The name will be displayed in theBrowsertree control.Use the drop-down listbox next to
Ownerto specify the owner of the event trigger.Store notes about the event trigger in the
Commentfield.
Click the Definition tab to continue.
Create Event Trigger dialog - Definition tab¶
Use the fields in the Definition tab to define the event trigger:
Select a value from the drop down of
Trigger Enabledfield to specify a status Select a value from the drop down ofTrigger Enabledfield to specify a statusUse the drop-down listbox next to
Trigger functionto specify an existing function. A trigger function takes an empty argument list, and returns a value of type event_trigger.Select a value from the drop down of
Eventsfield to specify when the event trigger will fire:DDL COMMAND START,DDL COMMAND END, orSQL DROP.Use the
When TAG infield to enter filter values for TAG for which the trigger will be executed. The values must be in single quotes separated by comma.
Click the Security Labels tab to continue.
Create Event Trigger dialog - Security tab¶
Use the Security tab to define security labels applied to the trigger. Click the Add icon (+) to add each security label.
Specify a security label provider in the
Providerfield. The named provider must be loaded and must consent to the proposed labeling operation.Specify a security label in the
Security Labelfield. The meaning of a given label is at the discretion of the label provider. PostgreSQL places no restrictions on whether or how a label provider must interpret security labels; it merely provides a mechanism for storing them.
Click the Add icon (+) to assign additional security labels; to discard a security label, click the trash icon to the left of the row and confirm deletion in the Delete Row popup.
Click the SQL tab to continue.
Your entries in the Domain Trigger dialog generate a generate a SQL command. Use the SQL tab for review; revisit or switch tabs to make any changes to the SQL command.
Example
The following is an example of the sql command generated by user selections in the Domain Trigger dialog:
Create Event Trigger dialog - SQL tab¶
The command creates an event trigger named accounts that invokes the procedure named acct_due.
Click the
Infobutton (i) to access online help. View context-sensitive help in theTabbed browser, where a new tab displays the PostgreSQL core documentation.Click the
Savebutton to save work.Click the
Cancelbutton to exit without saving work.Click the
Resetbutton to restore configuration parameters.