Thanks Andy > In addition, the role of the "when" clause is unclear. Is it necessary? > > I don't think it is. I have a very similar trigger which I've been using > for several years > And it doesn't have the where... > > CREATE TRIGGER [UpdatePortTime] AFTER UPDATE ON ports > FOR EACH ROW > BEGIN > UPDATE ports SET timeofday = CURRENT_TIMESTAMP WHERE id = NEW.id ; > END >
What stops the UPDATE ports SET timeofday = CURRENT_TIMESTAMP WHERE id = NEW.id ; from also triggering the AFTER UPDATE ON recursively? Perhaps a pragma or inSQLite are triggers non-recursive by default? I am using (now I have by semi-colons right) CREATE TRIGGER tgrUpdate AFTER UPDATE ON myTable FOR EACH ROW WHEN NEW.LastUpdate <= OLD. LastUpdate BEGIN UPDATE myTable SET LastUpdate = DATETIME('now') WHERE id = OLD.id; END My intention is for the when to avoid infinite calls, but maybe I am fooling myself. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users