SQLite Forum

DB with Fts4 passes integrity check, but throws SQLITE_CORRUPT_VTAB (database disk malformed) whenever column is queried
Login

DB with Fts4 passes integrity check, but throws SQLITE_CORRUPT_VTAB (database disk malformed) whenever column is queried

(1) By rustdev (rustdanielb) on 2021-09-13 16:03:13 [link] [source]

I have a db(456 MB) that has Fts4 attached. I am using a custom build of Sqlite 3.35.5. The db passes a pragma integrity check.

I can do a SELECT * FROM {fts virtual table} and it returns all the data found on the table just fine. However, when I query any column of that same table, I get a SQLITE_CORRUPT_VTAB (database disk malformed) error. Returning any built-in FTS functions such as match_info or snippet fails; however, if I call custom functions that I have added to my sqlite build, they work fine.

What is causing these issues to occur? Thanks!

(2) By Dan Kennedy (dan) on 2021-09-14 14:03:23 in reply to 1 [source]

Corrupt or missing records in the shadow tables used by fts4.

You might be able to fix things by rebuilding the index:

    INSERT INTO fts3_tbl_name(fts3_tbl_name) VALUES('rebuild');

If you're doing new development, fts5 is much better than fts4.

Dan.