Re: Rule, update and aggregate functions

Поиск
Список
Период
Сортировка
От Peter
Тема Re: Rule, update and aggregate functions
Дата
Msg-id 45c47cd0$0$1346$834e42db@reader.greatnowhere.com
обсуждение исходный текст
Ответ на Rule, update and aggregate functions  (pgsql-user <pgsql@vunet.de>)
Список 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 по дате отправления:

Предыдущее
От: Peter
Дата:
Сообщение: Re: Query optimization problem
Следующее
От: "Joris Dobbelsteen"
Дата:
Сообщение: Re: sql formatter/beautifier