From: | Uroš Gruber <uros(dot)gruber(at)sir-mag(dot)com> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | trigger ON delete |
Date: | 2002-11-15 07:10:44 |
Message-ID: | 20021115071044.5094C7061B@citka.sir-mag.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi!
I have problems with triggers on delete and i get some kind of
loop. Here is my function.
CREATE FUNCTION nset_delete() RETURNS opaque AS \'
DECLARE
visits int4;
BEGIN
visits := OLD.r - OLD.l + 1;
EXECUTE \'\'DELETE FROM \'\' || TG_RELNAME || \'\' WHERE
l BETWEEN \'\' || OLD.l || \'\' AND \'\' || OLD.r || \'\';\'\';
EXECUTE \'\'UPDATE \'\' || TG_RELNAME || \'\' SET
l=l-\'\' || visits || \'\' WHERE l>\'\' || OLD.l || \'\';\'\';
EXECUTE \'\'UPDATE \'\' || TG_RELNAME || \'\' SET
r=r-\'\' || visits || \'\' WHERE r>\'\' || OLD.r || \'\';\'\';
RETURN NULL;
END;
\' LANGUAGE \'plpgsql\';
CREATE TRIGGER nset_delete BEFORE DELETE ON nset FOR EACH ROW
EXECUTE PROCEDURE nset_delete();
When i delete some data from table nset and when it gets to
first EXECUTE (wich is DELETE) it fires trigger again and
again.
How can i solve this. Is this a bug?
--
\"Don\'t worry about people stealing your ideas. If your ideas
are any
good, you\'ll have to ram them down people\'s throats.\"
-- Howard Aiken
From | Date | Subject | |
---|---|---|---|
Next Message | Cedric Dufour (Cogito Ergo Soft) | 2002-11-15 08:47:23 | Re: [GENERAL] Upgrade to dual processor machine? |
Previous Message | Shridhar Daithankar | 2002-11-15 07:10:25 | Re: [PERFORM] Upgrade to dual processor machine? |