Michael Graßl <mich...@grassl.eu> wrote: > Am 02.09.10 21:18, schrieb Pavel Ivanov: >> The correct syntax is >> >> UPDATE sites SET createTime = DATETIME('NOW'), updateTime = >> DATETIME('NOW') >> WHERE rowid = new.rowid; > > Thanks this works. > >> So I wonder if you made a typo and actually only createTime were >> updated when updateTime remained unchanged. >> >> > Hm, I don't understand what you meaning, but this trigger get started > when a new row is added, and there is a second trigger which updates > only updateTime when a row gets updated....
Since your INSERT trigger performs an update, it causes UPDATE trigger to fire. That's how updateTime got set. Now, you are setting it twice. If you are very unlucky, it is possible for createTime and updateTime to be different right after insert (if the second just happens to change right between the two triggers firing). Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users