SQLite Forum

SQLite FTS5 table with 7 rows has _fts_docsize table with 9,141 rows
Login
The FTS5 data structures are internally consistent and there is no corruption at the database level but, as you say, the "licenses_fts" index does not match the contents of the "licenses" table.

Your triggers look correct to me.

Are you using "REPLACE INTO", or "UPDATE OR REPLACE" on the "licenses" table without having first executed "PRAGMA recursive_triggers = 1"? The docs note that delete triggers will not be fired in this case, which would explain things. Second paragraph under "REPLACE" here:

[](https://www.sqlite.org/lang_conflict.html)

Other than that, could there be any code that writes to "licenses_fts" directly - bypassing "licences" altogether.

Dan.