Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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
        UPDATE inventory
        SET in_stock = in_stock - NEW.used
        WHERE inventory.inventory_id =

Hope this helps,


Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!

In response to

pgsql-novice by date

Next:From: Ludwig LimDate: 2002-10-23 16:13:20
Subject: Re: Re[1] Display SELECT
Previous:From: Devinder K RajputDate: 2002-10-23 16:01:11
Subject: Re: Display SELECT

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group