I dropped the constraint and added the trigger.
strange. works as expected in the sqlite3 exe. in C code, I get "constraint failed" from sqlite3_errmsg. If I drop the trigger shown below, the C code has no constraint violation as would be expected which means the trigger is causing the constraint violation. sqlite> .dump BEGIN TRANSACTION; CREATE TABLE test1(i INTEGER, a INTEGER, b INTEGER, c INTEGER, d INTEGER); INSERT INTO "test1" VALUES(0,1,2,3,4); INSERT INTO "test1" VALUES(1,10,20,30,40); INSERT INTO "test1" VALUES(2,100,200,300,400); INSERT INTO "test1" VALUES(3,1000,2000,3000,4000); INSERT INTO "test1" VALUES(4,10000,20000,30000,40000); INSERT INTO "test1" VALUES(5,100000,200000,300000,400000); CREATE TABLE test1a(i INTEGER, a INTEGER, b INTEGER); CREATE TABLE test1b(i INTEGER, c INTEGER, d INTEGER); CREATE TRIGGER trig BEFORE INSERT ON test1b BEGIN SELECT CASE WHEN (1) THEN RAISE(ABORT, 'no parent element') END; END; COMMIT; sqlite> INSERT INTO "test1b" VALUES(1,10,20); SQL error: no parent element sqlite> On Jul 1, 2009, at 6:40 PM, Simon Slavin wrote: > > On 2 Jul 2009, at 1:57am, James Gregurich wrote: > >> I tried that, but I still got back "constraint failed" rather than my >> RAISE message. Since you say it should work, I probably did something >> wrong. I'll look at it again. > > If you left the constraint definition in in your table definition then > you're getting an error from that rather than from the trigger. > > Simon. > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users