Hi,
I have run into an issue when trying to use triggers with column
constraints on Android (using our build of SQLite 3.8.2, not Android's
built-in version from native code.) Executing the following on a
file-backed database fails:
CREATE TABLE things (number INTEGER NOT NULL);
CREATE TRIGGER on_insert_thing AFTER INSERT ON things BEGIN SELECT NULL;
END;
BEGIN;
INSERT INTO things (number) VALUES (1);
INSERT INTO things (number) VALUES (2);
END;
But if I do any of the following, it does not fail:
- add ON CONFLICT FAIL to the NOT NULL constraint
- remove the NOT NULL constraint
- remove the trigger
- remove the transaction BEGIN and END
- use an in-memory database
- run on my development machine (Linux based)
This is reproduced in the attached program (includes SQLite 3.8.2), which
gives the following output when built for armeabi-v7a and run on either an
armeabi-v7a emulator (with SD card) or a Samsung Galaxy Note 2:
$ env ANDROID_NDK=/path/to/android-ndk-r9b ./build.sh && ./run.sh
Log(14): cannot open file at line 29016 of [27392118af] --- I think
this is from the 3.8.2 amalgamation source file
Log(14): os_unix.c:29016: (30) open(./etilqs_mRlOFvBwZiFYwdW) -
Log(14): statement aborts at 8: [INSERT INTO things (number) VALUES (2);]
Error(14): unable to open database file
At this point, I realize I am out of my depth, so am happy to avoid the "ON
CONFLICT ABORT" behaviour that seems to be causing the problem, but thought
I should at least mention what I saw, in case I'm using SQLite in an
invalid way.
Thanks,
Doug
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users