pgadmin4/docs/en_US/event_trigger_dialog.rst

94 lines
3.6 KiB
ReStructuredText
Raw Normal View History

2016-06-21 03:06:44 -05:00
.. _event_trigger_dialog:
2016-05-13 08:43:57 -05:00
2018-06-15 03:14:12 -05:00
*****************************
`Event Trigger Dialog`:index:
*****************************
2016-05-13 08:43:57 -05:00
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.
2016-05-13 08:43:57 -05:00
2016-05-20 15:39:21 -05:00
.. image:: images/event_trigger_general.png
:alt: Event trigger dialog general tab
:align: center
2016-05-13 08:43:57 -05:00
Use the fields in the *General* tab to identify the event trigger:
* Use the *Name* field to add a descriptive name for the event trigger. The name
will be displayed in the *pgAdmin* tree control.
* Use the drop-down listbox next to *Owner* to specify the owner of the event
trigger.
2016-05-24 07:47:35 -05:00
* Store notes about the event trigger in the *Comment* field.
2016-05-13 08:43:57 -05:00
Click the *Definition* tab to continue.
2016-05-20 15:39:21 -05:00
.. image:: images/event_trigger_definition.png
:alt: Event trigger dialog definition tab
:align: center
2016-05-13 08:43:57 -05:00
Use the fields in the *Definition* tab to define the event trigger:
* Select a radio button in the *Enabled Status* field to specify a status for
the trigger: *Enable* *Disable*, *Replica* *Always*.
* Use the drop-down listbox next to *Trigger function* to specify an existing
function. A trigger function takes an empty argument list, and returns a
value of type event_trigger.
* Select a radio button in the *Events* field to specify when the event trigger
will fire: *DDL COMMAND START*, *DDL COMMAND END*, or *SQL DROP*.
* Use the *When* field to write a condition for the event trigger that must be
satisfied before the event trigger can execute.
2016-05-13 08:43:57 -05:00
Click the *Security Labels* tab to continue.
2016-05-13 08:43:57 -05:00
2016-05-20 15:39:21 -05:00
.. image:: images/event_trigger_security.png
:alt: Event trigger dialog security tab
:align: center
2016-05-13 08:43:57 -05:00
Use the *Security* tab to define security labels applied to the trigger. Click
the *Add* icon (+) to add each security label.
2016-05-13 08:43:57 -05:00
* Specify a security label provider in the *Provider* field. The named provider
must be loaded and must consent to the proposed labeling operation.
* Specify a security label in the *Security Label* field. 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.
2016-05-13 08:43:57 -05:00
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.
2016-05-13 08:43:57 -05:00
2016-05-24 07:47:35 -05:00
Click the *SQL* tab to continue.
2016-05-13 08:43:57 -05:00
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.
2016-05-13 08:43:57 -05:00
Example
*******
2016-05-24 07:47:35 -05:00
The following is an example of the sql command generated by user selections in
the *Domain Trigger* dialog:
2016-05-13 08:43:57 -05:00
2016-05-20 15:39:21 -05:00
.. image:: images/event_trigger_sql.png
:alt: Event trigger dialog sql tab
:align: center
2016-05-13 08:43:57 -05:00
The command creates an event trigger named *accounts* that invokes the procedure
named *acct_due*.
* Click the *Info* button (i) to access online help.
2016-05-13 08:43:57 -05:00
* Click the *Save* button to save work.
* Click the *Cancel* button to exit without saving work.
* Click the *Reset* button to restore configuration parameters.