SQLite Forum

Duplicated rows (and missing rows) when SELECTing with ORDER BY
Login
Thank you David and Harald. `PRAGMA integrity_check;` revealed that some rows were simply missing in the respective indices, the output being something like:
```
row 10828 missing from index path_index
row 10828 missing from index sqlite_autoindex_files_2
row 10829 missing from index path_index
row 10829 missing from index sqlite_autoindex_files_2
....
wrong # of entries in index path_index
wrong # of entries in index sqlite_autoindex_files_2
```

As suggested, the `recover` command was able to repair the database without data loss (although a `REINDEX` command should have been sufficient as well, in this particular case). Interestingly, the encoding of special chars got broken in the `new.db` file, not sure why.