3.6. Rules

Rules are objects that store additional SQL commands which are executed whenever a select, insert, delete or update is performed on a table. Unlike triggers, which can be executed on each row modification, rules are executed when the entire table is changed no matter how many rows were modified.

Attribute Description
Event Event that will execute the rule. Possible values are ON SELECT, ON DELETE, ON UPDATE, and ON TRUNCATE.
Execution Type Mode in which the rule must be executed. If ALSO is used indicates that the commands stored in the rule must be executed in addition to the original one (that fired the rule). If INSTEAD is used then the commands stored will be executed in place of the original one.
Conditional Expression A simple SQL conditional expression that returns a boolean value. The expression can't reference any tables as well as use aggregate functions.
Commands This group of fields is used to handle the commands executed by the rule.

Mar 8, 2021 at 14:30