I am using sqlite to implement document file format in my program.
I got a document file (sqlite database) from user where the image embedded into the document note is displayed OK, but disappears on the next load of the same document (even if no user editing action was done). The only database modification were alter table statements to adapt this document to a newer version of the file format (new tables, some new fields). No sqlite error was logged during this procedure, but the resulting database seems to have an invalid index.

Running this query on the database fails to find the image entry with the matching ID:
SELECT * FROM images WHERE note_id="2O7Ej89J3K8Fax5OedEiQQ"

but this query works OK (lists the matching item):
SELECT * FROM images WHERE note_id LIKE "2O7Ej89J3K8Fax5OedEiQQ"

Corrupted database file can be downloaded from here:
http://notecasepro.com/temp/new.zip

Original database (non-corrupted, before altering) is available here:
http://notecasepro.com/temp/old.zip

Note that I had to delete other tables to protect customer info. If I "VACUUM" the database, bug is gone (but only when done on this minimal sample, not when done on entire document file). Current pre-release version of the program that corrupted the database uses sqlite v3.13.0, compiled with these flags:
SQLITE_ENABLE_COLUMN_METADATA
SQLITE_OMIT_AUTHORIZATION
SQLITE_OMIT_CAST
SQLITE_OMIT_DEPRECATED
SQLITE_OMIT_EXPLAIN
SQLITE_OMIT_UTF16
SQLITE_OMIT_PROGRESS_CALLBACK
SQLITE_OMIT_LOAD_EXTENSION
SQLITE_OMIT_SHARED_CACHE
SQLITE_OMIT_COMPLETE
SQLITE_OMIT_BUILTIN_TEST
SQLITE_OMIT_CHECK
SQLITE_OMIT_COMPOUND_SELECT
SQLITE_OMIT_CONFLICT_CLAUSE
SQLITE_OMIT_INCRBLOB
SQLITE_OMIT_MEMORYDB
SQLITE_OMIT_TEMPDB
SQLITE_OMIT_TCL_VARIABLE
SQLITE_OMIT_TRACE
SQLITE_OMIT_BLOB_LITERAL
SQLITE_CORE

Note that the old (uncorrupted) document was probably created in one of previous versions of sqlite. Issue can be reproduced on Windows and Mac (probably other platforms as well, did not test).

Is this enough info to verify/solve the issue?
If needed, I can try to persuade the customer to give access to the full document file to someone outside testing this, outside the mailing list (directly to email) or gather any additional data.

Regards,
  Miroslav
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to