On 10/01/07, Nicolai Tufar <[EMAIL PROTECTED]> wrote:
Hi all,
We plan to port a small problem from MS SQL to Ingres. Almost every
table has one ON UPDATE trigger that updates username column with
relevant information. We try to port it to Ingres and alas, there are
no BEFORE rules in Ingres :(
We tried to do it with AFTER:
CREATE TABLE test (id INT, username VARCHAR(10));
CREATE PROCEDURE test_upd_proc(id INT) AS
BEGIN
UPDATE test SET username=CURRNET_USER WHERE id=:id;
END;
CREATE RULE test_rule_upd AFTER UPDATE ON test
FOR EACH ROW
EXECUTE PROCEDURE test_upd_proc(id = NEW.id);
But when you update the table procedure because of UPDATE statement on the same
table in procedure, rule gets executed over and over again until it
reaches the limit of
recursion and throws the error:
E_QE0208 Query exceeds the limit (20) for cascading rules and nested
database procedures. The query is aborted
with fatal error.
Does anyone know an easy way to do it? I wish Ingres had BEFORE rules. :(
Ingres 2006 Release 2 - currently beta for Linux - has BEFORE rules.
http://ingres.com/download_community/Prod_Community_Downloads.html
hth
--
Paul Mason
_______________________________________________
Users mailing list
Users@lists.ingres.com
http://lists.ingres.com/mailman/listinfo/users