Creating Custom Rules
Rules are very similar to triggers in concept, with some crucial differences. Triggers usually refer exclusively to the table being acted on, whereas rules act on external tables. Additionally, triggers are fired in addition to the action being carried out. For instance, an INSERT trigger will fire the event either before or after the insert is performed.
Rules, on the other hand, can also be created with the optional keyword INSTEAD. In this case, the rule action is carried out in lieu of the specified action.
A typical use of rules is to perform actions on external tables when a table-related event occurs on the specified table. A simple use of a rule set would be to implement the capability to log an audit trail of changes ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access