From: Madel, Kurt <KMadel@USInspect.com>
To: pgsql-sql@postgresql.org
Subject: Trying to Creat a Rule
Date: Fri, 11 Aug 2000 13:14:42 -0400
Message-ID: <C6F9B91B745CD4119F1500A0C9DD60C02E346D@exchhq01.usinspect.com> (raw)
Hello,
I am trying to create a RULE that updates the size of a class when a student
registers for that class and the register(module) table is updated, and
subtract 1 from the given class size when a student drops a course.
Actually, there is a class table and a module table. The class table's
primary key is id, the module table consists of every module that a student
can register for a given year containing a class id.
I think I have the INSERT RULE down, but am not sure about the UPDATE RULE:
CREATE RULE module_update AS
ON UPDATE TO module.a_q1
DO
SET class.size to class.size-1
WHERE class.id=old.a_q1
AND
set class.size to class.size+1
WHERE class.id=new.a_q1;
I am really not so sure about the 'and' part, but I need to do both updates
on class, using different WHERE criteria.
TIF,
Kurt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: KMadel@USInspect.com
Subject: Re: Trying to Creat a Rule
In-Reply-To: <C6F9B91B745CD4119F1500A0C9DD60C02E346D@exchhq01.usinspect.com>
References: <C6F9B91B745CD4119F1500A0C9DD60C02E346D@exchhq01.usinspect.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox