SQL Rule

Поиск
Список
Период
Сортировка
Искать
От
Bert
Тема
SQL Rule
Дата
Msg-id
1146000443.806482.225410@y43g2000cwc.googlegroups.com
Список
Дерево обсуждения
SQL Rule "Bert" <clemens.bertschler@gmail.com>
Re: SQL Rule Wayne Conrad <wconrad@yagni.com>
Re: SQL Rule Oisin Glynn <me@oisinglynn.com>
Re: SQL Rule Kenneth Downs <ken@secdat.com>
Re: SQL Rule "Bert" <clemens.bertschler@gmail.com>
Re: SQL Rule "Bert" <clemens.bertschler@gmail.com>
Re: SQL Rule Kenneth Downs <ken@secdat.com>
Re: SQL Rule Alan Hodgson <ahodgson@simkin.ca>
Re: SQL Rule Alban Hertroys <alban@magproductions.nl>
Hi list

I have a table construction like the one seen below, when i am updating
or inserting i get a recurion, logical. But how to manage it that the
rule is just doing it one time. Or is it possible to do the sum of a
and b in an other way?

CREATE TABLE test
(
  a int2,
  b int2,
  c int2,
  id int2 NOT NULL,
  CONSTRAINT id_test PRIMARY KEY (id)
)
WITHOUT OIDS;
ALTER TABLE test OWNER TO postgres;


CREATE OR REPLACE RULE sum_op AS
    ON INSERT TO test DO  UPDATE test SET c = new.a + new.b
  WHERE test.id = new.id;

CREATE OR REPLACE RULE sum_op_up AS
    ON UPDATE TO test DO  UPDATE test SET c = test.a + test.b
  WHERE test.id = new.id;

В списке pgsql-general по дате отправления
От: Andrew - Supernews
Дата:
От: Oisin Glynn
Дата:
Сообщение: Re: SQL Rule
FAQ