It seems that you aren't allowed to specify OFFSET in sqlite unless you also specify LIMIT (line 844 of TDDatabase.java):
cursor = database.rawQuery("SELECT revid FROM revs WHERE doc_id=? AND current " +
"ORDER BY revid DESC OFFSET 1", args);
needs to be "ORDER BY revid DESC LIMIT -1 OFFSET 1".
The grammar described on the SQLite page seems to support what you're saying:
I still see the same query in the iOS branch so I'm also tagging it for review by Jens.
Yeah, it looks like the -getConflictingRevisions method was untested :( I just added a unit test for it, and sure enough, it gets a SQL error about the OFFSET keyword.
Maybe we should just delete this method, since nothing calls it?
Yes, you're right its not referenced anywhere. Paul, did you uncover this reviewing the code or were you trying to use the method for something?
I expect that it would be useful to be able to get a list of conflicting revisions if you had to resolve any replication conflicts in TouchDB, though, so maybe it would be good to keep the method. I did change the SQL my local fork as described above and the error goes away.
We're looking into this, can you supply a quick test case? @pegli
What's the actual / expected behavior, and how can we reproduce to make sure we've fixed it?