Hi folks,

The document of "PRAGMA integrity_check" says:

> If the integrity_check pragma finds problems, strings are returned (as
multiple rows with a single column per row) which describe the problems.

But it doesn't specify the exit value of:

$ sqlite some-db.sqlite "PRAGMA integrity_check"

Usually, if the database corrupts, the exit value is non-zero. However, I
recently bumped into a corrupted sqlite file that makes the previous
command exit with zero.

Here is the execution result:

$ sqlite3 some-db.sqlite 'PRAGMA integrity_check'
*** in database main ***
Page 6153: btreeInitPage() returns error code 11
Page 6053: btreeInitPage() returns error code 11
Page 5953: btreeInitPage() returns error code 11
... (ignore similar lines)
Page 261: btreeInitPage() returns error code 11
Page 133: btreeInitPage() returns error code 11
Page 132: btreeInitPage() returns error code 11
Page 3 is never used
Page 4 is never used
Page 5 is never used
Page 6 is never used
... (ignore similar lines)
Page 38 is never used
Page 39 is never used
Page 40 is never used
Page 41 is never used
$ echo $?
0
$ sqlite3 some-db.sqlite 'SELECT * FROM task_status;'
Error: database disk image is malformed
$ echo $?
11

Thank you for your help!

Best,
John Lin
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to