On Fri, Jan 07, 2011 at 06:29:05PM -0700, Drake Wilson wrote: > Quoth Nicolas Williams <nicolas.willi...@oracle.com>, on 2011-01-07 19:12:13 > -0600: > > But the real problem is that my triggers will just recurse infinitely, > > since I need both, AFTER INSERT and AFTER UPDATE triggers. The AFTER > > INSERT trigger will trigger the AFTER UPDATE trigger, and that one will > > trigger itself, recursing ad naseum. This [obviously] happens in the > > case of UPDATEs too. > > > > I need a way to break this recursion. > > > > One idea I'm considering is to have two columns where I have one: > [...] > > Another idea is that I could use temp triggers and temp tables instead, > [...] > > Pardon me if this is too awkward, but could you not use a trivial view > (AS SELECT * FROM ...) and then make INSTEAD OF INSERT/UPDATE/DELETE > triggers on that? The application could use the view exclusively; the > physical table would be in the background, and the view would act like > a shadow table. (The DELETE case would just be transparent and key on > the row IDs, I expect, if you don't need to do anything there.)
Hmmm, yes, that seems very likely to work. I'll give it a whirl. Thanks! Any other ideas? I would like to be able to add triggers to an existing schema without having to change everything around nor disable recursive triggers... Nico -- _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users