I've never seen this before. In my application I executed the command
INSERT INTO books DEFAULT VALUES
and my application crashed inside the sqlite library. But I don't want you to
try to debug my app so I tried the same thing in the command-line utility and
got a crash with
Segmentation fault
First, I'd better check: is that syntax of my command right ? If it is, then
even if there's a problem in my schema, I should expect some sort of error
message rather than a crash, right ?
--------------------------------------------------------------------------------
Here, I think, is enough for you to reproduce the problem:
I'm running on OS X 10.6.6. My own app includes the amalgamation source for
version 3.6.23 but the command-line tool is apparently using the OS X native
version 3.6.12.
CREATE TABLE authors (id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT UNIQUE DEFAULT 'name unknown',
yearBorn INTEGER DEFAULT 2010,
sortOrder TEXT DEFAULT '');
INSERT INTO "authors" VALUES(0,'Unknown authors',9999,'zzzzz');
CREATE TABLE books (id INTEGER PRIMARY KEY AUTOINCREMENT,
author INTEGER DEFAULT 0,
title TEXT DEFAULT 'title unknown');
CREATE TRIGGER authors_books_insert BEFORE INSERT ON books FOR EACH ROW BEGIN
SELECT RAISE(ROLLBACK, 'Attempt to add a book with an author number
which is not valid.') WHERE (SELECT id FROM authors WHERE id = new.author) IS
NULL;
END
INSERT INTO books DEFAULT VALUES;
It is, of course, the TRIGGER which causes the crash. Without that, there's no
problem.
Simon.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users