In a given database, there are many possible events. These events which causes a change to the contents of a table sometimes should have another associated action. These actions are performed by the DBMS to make checks on the table before or after a modification has been applied to the table.

A trigger was created to deal with these types of situations. The action carried out by the DBMS is triggered by a sequence of sequel statements that defines the trigger. Triggers only apply to events that use one of INSERT , DELETE , or UPDATE .

The examples in this sect1 use the PL/pgSQL language to define some functions. If you are not yet familiar with PL/pgSQL, you may want to look at part VI.