Description
https://github.com/couchbase/couchbase-lite-core/issues/865
I try to create query with OFFSET, but without LIMIT.
{{ {"WHAT": ["._id"], "WHERE": ["=", [".type"], "MyDoc"], "ORDER_BY": [["DESC", [".departure_time"]], \
["ASC", ["._id"]]],"OFFSET": 1}}}
couchbase-lite-core converts it to
{{SELECT fl_result(_doc.key) FROM kv_default AS _doc WHERE (fl_value(_doc.body, 'type') = \
'MyDoc') AND (_doc.flags & 1 = 0) ORDER BY fl_value(_doc.body, 'departure_time')}}
But this is invalid SQL from sqlite point of view.
Normal way to fix this for sqlite is adding LIMIT -1 before OFFSET,
but after #329 was fixed it is impossible LIMIT -1 is converted to LIMIT MAX(0, -1) and not works as expected.