sqlite3 - "UPDATE OR ROLLBACK" produces a different result than "UPDATE" when used together with "INSERT OR REPLACE" trigger and unique constraint -
i'm using sqlite3 version 3.8.8.3 , i'm wondering whether following problem leads expected result:
begin transaction; create table ta ( integer(10) not null, id integer not null primary key ); insert "ta" values(1,1); insert "ta" values(2,2); insert "ta" values(3,3); create table tb ( integer(10) not null, constraint c unique (a) ); insert "tb" values(2); insert "tb" values(1); create trigger t after update on ta each row when (old.a != new.a ) begin insert or replace tb(a) select new.a; end; commit; update or rollback ta set a=3;
--> error: unique constraint failed: tb.a
Comments
Post a Comment