Uploaded image for project: 'Couchbase Lite'
  1. Couchbase Lite
  2. CBL-529

Cannot create an offset query without limit

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • 2.8.0
    • 2.7.0
    • LiteCore
    • Security Level: Public
    • None
    • 5

    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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jens Jens Alfke
            jimb Jim Borden
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty