Rule system
Creating a rule will either rewire the default rule or create a new rule for specific action on a specific table or view. In other words, a rule on an insert action can change the insert action's behavior or create a new action for insert. When using the rule system, note that it is based on the C macro system. This means that you can get strange results when it is used with volatile functions, such as random(), and sequence functions, such as nextval(). The following example shows how tricky the rule system can be. Let's suppose that we would like to audit the table for car. For this reason, a new table, called car_log, will be created to keep a track of all of the actions on the car table, such as UPDATE, DELETE, and INSERT ...
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