Re: Rule, update and aggregate functions

From: Peter <peter(at)greatnowhere(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Rule, update and aggregate functions
Date: 2007-02-03 12:17:30
Message-ID: 45c47cd0$0$1346$834e42db@reader.greatnowhere.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Hi,
>
> I got stuck with the following problem and strangely couldn't find
> anything similar in the list:
>
> Assume two tables:
> table: warehouse, columns: id, incoming, outgoing
> table: articles, columns: id, articles_in_stock
>
> All I want is to create a rule, that everytime when articles leave or
> get in the warehouse, the sum of articles is updated in articles database.
>

Why are you trying rules? Trigger function would be much more logical
choice. There are some limitations in RULE syntax that won't let you use
all SQL statements there, so trigger might be your only way out

Peter

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joris Dobbelsteen 2007-02-03 12:41:44 Re: sql formatter/beautifier
Previous Message Peter 2007-02-03 10:58:08 Re: Query optimization problem