Peter Bartholdsson wrote:
Think the topic explains it but there any way to enable recursive triggers?
Aka, triggers that run as result of a change by a trigger.


Recursive triggers are on the todo list. They are a prerequisite for the planned implementation of foreign keys.

One stubling block with recursive triggers is that a recursive
trigger can result in an infinite loop.  I sent out a query a
month or so ago requesting ideas on how to detect and deal with
infinite loops in recursive triggers.  I got a few helpful
responses.  More input would be appreciated.

Example:  How should SQLite deal with this:

   CREATE TABLE ex1(a INTEGER);
   INSERT INTO ex1 VALUES(1);
   CREATE TRIGGER tr1 AFTER UPDATE ON ex1 BEGIN
     UPDATE ex1 SET a=a+1 WHERE rowid=old.rowid;
   END;

   UPDATE ex1 SET a=2 WHERE a=1;  -- infinite loop here


-- D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565



Reply via email to