Received: from exchhq01.usinspect.com (exchhq01.usinpect.com [208.233.45.2] (may be forged)) by hub.org (8.10.1/8.10.1) with ESMTP id e7EKeww78215 for ; Mon, 14 Aug 2000 16:40:59 -0400 (EDT) Received: by exchhq01.usinspect.com with Internet Mail Service (5.5.2650.21) id ; Mon, 14 Aug 2000 16:40:14 -0400 Message-ID: From: "Madel, Kurt" To: pgsql-sql@postgresql.org Subject: Creating A Rule to Increment a class size when a student adds tha t class to their schedule Date: Mon, 14 Aug 2000 16:40:09 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" X-Archive-Number: 200008/97 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