RE: [sqlite] Are DELETE TRIGGERS recursive or not?
Hello Allan, Mark, I am not sure, but I don't think recursive delete triggers apply to your web-page example. I was looking for recursive delete triggers because the information I need to store in a single table is hierarchical in a sense that a record can refer to another record in the same table (like when storing a tree structure). With recursive delete triggers, a single delete would automatically delete all children AND GRANDCHILDREN of that tree's node. Deleting children with triggers is possible without recursion, but you need recursive delete triggers to delete the grandchildren also. I don't know if recursive delete triggers will improve performance, but they will certainly make it easier to maintain referential integrity for hierarchical, tree-like data. Regards, Ralf >Have you had a look at the following web-page:- > >http://www.justatheory.com/computers/databases/sqlite > >This is a way of enforcing referential integrity in SQlite with triggers >although evidently not with recursive triggers. >We have implemented this in our system. Would you mind explaining to me the >benefit of recursive triggers for this purpose? I ask as we are trying hard to >optimise the performance of our deletes, do you think using recursive triggers >(when implemented) will be more efficient at cascading deletes?
RE: [sqlite] Are DELETE TRIGGERS recursive or not?
Hi Ralf, Have you had a look at the following web-page:- http://www.justatheory.com/computers/databases/sqlite This is a way of enforcing referential integrity in SQlite with triggers although evidently not with recursive triggers. We have implemented this in our system. Would you mind explaining to me the benefit of recursive triggers for this purpose? I ask as we are trying hard to optimise the performance of our deletes, do you think using recursive triggers (when implemented) will be more efficient at cascading deletes? Thanks Mark > -Original Message- > From: Ralf Junker [mailto:[EMAIL PROTECTED] > Sent: 26 October 2005 16:58 > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] Are DELETE TRIGGERS recursive or not? > > > Hello [EMAIL PROTECTED], > > Thank you! I am very much looking forward to recursive delete > triggers for just the very purpose you mentioned! > > Regards, > > Ralf > > >Not at this time. Though work is underway to change this. > >We need recusive delete triggers in order to implement > >cascadinig deletes for referential integrity. > > > DISCLAIMER: This information and any attachments contained in this email message is intended only for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential, and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution, forwarding, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by return email, and delete the original message immediately.
Re: [sqlite] Are DELETE TRIGGERS recursive or not?
Hello [EMAIL PROTECTED], Thank you! I am very much looking forward to recursive delete triggers for just the very purpose you mentioned! Regards, Ralf >Not at this time. Though work is underway to change this. >We need recusive delete triggers in order to implement >cascadinig deletes for referential integrity.
Re: [sqlite] Are DELETE TRIGGERS recursive or not?
Ralf Junker <[EMAIL PROTECTED]> wrote: > I wonder if a DELETE TRIGGER should trigger itself recursively Not at this time. Though work is underway to change this. We need recusive delete triggers in order to implement cascadinig deletes for referential integrity. -- D. Richard Hipp <[EMAIL PROTECTED]>
Re: [sqlite] Are DELETE TRIGGERS recursive or not?
If the trigger were recursive, it would invoke itself forever, even if it's not doing anything because the where clause fails. Regards
[sqlite] Are DELETE TRIGGERS recursive or not?
I wonder if a DELETE TRIGGER should trigger itself recursively in the following scenario: create table f (i integer primary key, p integer, n text); create trigger f_delete after delete on f begin delete from f where p = old.i; end; insert into f values (1, null, 'folder 1'); insert into f values (3, 1, 'file 1 in folder 1'); insert into f values (4, 1, 'file 2 in folder 1'); insert into f values (2, null, 'folder 2'); insert into f values (5, 2, 'file 1 in folder 2'); insert into f values (6, 2, 'file 2 in folder 2'); insert into f values (7, 2, 'folder1 in folder 2'); insert into f values (8, 2, 'folder2 in folder 2'); insert into f values (9, 7, 'file 1 in folder 1 in folder 2'); insert into f values (10, 7, 'file 2 in folder 1 in folder 2'); Then I call: delete from f where i = 2; I would like this statement to delete (via the trigger) all rows except for the first three (1, 3, 4) inserts. However, the last two inserts (9, 10) stay undeleted. My question (SQLite 3.2.7): Are delete triggers recursive? Should a delete caused by a trigger fire another trigger? Or is this a bug? Unfortunately, I did not find any details in the help so any comments are very welcome. Regards, Ralf