infinite recursion detected in rules for relation "..."
От | Sebastian Böck |
---|---|
Тема | infinite recursion detected in rules for relation "..." |
Дата | |
Msg-id | 419F3F92.1050005@freenet.de обсуждение исходный текст |
Ответы |
Re: infinite recursion detected in rules for relation "..."
Re: infinite recursion detected in rules for relation "..." |
Список | pgsql-general |
Hello all, i have a problem migrating my application from version 7.4 to 8.0. Everything is fine in 7.4 but with 8.0 i get the following error: infinite recursion detected in rules for relation "..." I've been able to narrow the problem down to the attached SQL. I don't know wether its a bug or a "feature". Can someone explain me this behaviour. Thanks in advance Sebastian CREATE TABLE ref ( name TEXT NOT NULL PRIMARY KEY ); CREATE TABLE test ( id SERIAL PRIMARY KEY, col1 TEXT NOT NULL UNIQUE, col2 TEXT NOT NULL REFERENCES ref ON UPDATE CASCADE ); CREATE TABLE log ( id INTEGER NOT NULL, col1 TEXT NOT NULL, col2 TEXT NOT NULL ); CREATE OR REPLACE RULE log AS ON UPDATE TO test DO INSERT INTO log VALUES (OLD.id,OLD.col1,OLD.col2); CREATE VIEW bug AS SELECT * FROM test; CREATE OR REPLACE RULE upd AS ON UPDATE TO bug DO INSTEAD NOTHING; CREATE OR REPLACE RULE upd_col1 AS ON UPDATE TO bug WHERE NEW.col1 <> OLD.col1 DO UPDATE test SET col1 = NEW.col1 WHERE id = OLD.id; CREATE OR REPLACE RULE upd_col2 AS ON UPDATE TO bug WHERE NEW.col2 <> OLD.col2 DO UPDATE test SET col2 = NEW.col2 WHERE id = OLD.id; INSERT INTO ref (name) VALUES ('Name'); INSERT INTO test (col1,col2) VALUES ('Test 1','Name'); UPDATE bug SET col1 = 'Test' WHERE id = 1;
В списке pgsql-general по дате отправления: