Thread: Creating A Rule to Increment a class size when a student adds tha t class to their schedule

I am trying to create a rule that will increment the class.size in one table
when a student adds that class to their schedule in another table (module).
Basically, there are 3 tables involved:

class
module
student

When a student registers for their classes, the class.id is placed in its
respective module, the student.id is placed in module.student_id which is
combined with module.year to make up the primary key in the module table.

CREATE RULE class_size_increment_cq1 AS 
ON INSERT TO module.c_q1 
DO 
SET class.size to class.size+1 
WHERE class.id=module.c_q1;

This doesn't seem to be working.  Would it be just as fast or faster to use
a transaction:

begin;

insert into module.c_q1.....

update class set class.size to class.size+1 where class.id=module.c_q1;

commit;

TIF,
Kurt