On Fri, Jan 14, 2011 at 9:48 AM, Simon Slavin <slav...@bigfraud.org> wrote:

> 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 ?
>

Thanks for the bug report, and for including a reproducible test script with
the report.

This problem was previously reported and fixed.  See
http://www.sqlite.org/src/tktview/f3162063 for the bug report and
http://www.sqlite.org/src/tkttimeline/f316 for a timeline of the bug report
and its fix.  This fix appeared in releases 3.6.23.1 and 3.7.0.



>
>
> --------------------------------------------------------------------------------
>
> 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
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



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

Reply via email to