Re: Rule, update and aggregate functions - Mailing list pgsql-general

From Peter
Subject Re: Rule, update and aggregate functions
Date
Msg-id 45c47cd0$0$1346$834e42db@reader.greatnowhere.com
Whole thread Raw
In response to Rule, update and aggregate functions  (pgsql-user <pgsql@vunet.de>)
List 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

pgsql-general by date:

Previous
From: Peter
Date:
Subject: Re: Query optimization problem
Next
From: "Joris Dobbelsteen"
Date:
Subject: Re: sql formatter/beautifier