Re: a rule question

From: Ludwig Lim <lud_nowhere_man(at)yahoo(dot)com>
To: Brad Paul <bpaul(at)carolina(dot)rr(dot)com>
Cc: PostgreSQL Mailing List <pgsql-novice(at)postgresql(dot)org>
Subject: Re: a rule question
Date: 2002-10-23 16:05:32
Message-ID: 20021023160532.89482.qmail@web80310.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


--- Brad Paul <bpaul(at)carolina(dot)rr(dot)com> wrote:
> I have also tried:
>
> create rule inventory_usage_insert_rule as
> on insert to inventory_usage
> do
> update inventory set
> new.in_stock=old.in_stock-inventory_usage.used
> where
> inventory.inventory_id=inventory_usage.inventory_id;
>

Try recoding it as :

CREATE RULE inventory_usage_insert_rule AS
ON INSERT TO inventory_usage
DO
UPDATE inventory
SET in_stock = in_stock - NEW.used
WHERE inventory.inventory_id =
NEW.inventory_id;

Hope this helps,

ludwig.

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Ludwig Lim 2002-10-23 16:13:20 Re: Re[1] Display SELECT
Previous Message Devinder K Rajput 2002-10-23 16:01:11 Re: Display SELECT