Hello,
If I have a value in a table, and use INSERT OR REPLACE to update the value, a trigger created with AFTER UPDATE ON won't fire. Shouldn't an INSERT OR REPLACE to a table which already contain data which are beeing replaced be considered an "update" of the table?

CREATE table t1 (
    value INT
);

CREATE table t2 (
    text VARCHAR(30)
);

CREATE trigger trigger_1 AFTER INSERT on t1
BEGIN
    INSERT INTO t2 values("trigger 1 fired");
END;

CREATE trigger trigger_2 AFTER UPDATE on t1
BEGIN
    INSERT INTO t2 values("trigger 2 fired");
END;

-- fires trigger 1 as expected
INSERT OR REPLACE INTO t1 VALUES("1");

--this will also fire trigger 1, even though the action updates an already existing value in t1
INSERT OR REPLACE INTO t1 VALUES("2");


Best Regards,
Daniel

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to