Uploaded image for project: 'Couchbase Gateway'
  1. Couchbase Gateway
  2. CBG-2031

[3.0.1 Backport] _user endpoint pagination causes query error

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 3.0.1
    • 3.0
    • SyncGateway
    • Security Level: Public
    • None
    • CBG Sprint 97
    • 1

    Description

      On Sync Gateway/3.0.0(541;46803d1),

      invoking server:4985/bucketname/_user/ gets the following error
       

      {  "error": "Internal Server Error",  
         "reason":"Internal error: parsing failure | {\"statement\":\"SELECT META(`bucketname`).id FROM `bucketname` USE INDEX(sg_syncDocs_x1) WHERE META(`bucketname`).id LIKE '\\\\\\\\_sync:%' AND (META(`ipc-20002-prod`).id LIKE '\\\\\\\\_sync:user:%' OR META(`ipc-20002-prod`).id LIKE '\\\\\\\\_sync:role:%') ORDER BY META(`bucketname`).id LIMIT 5000 AND META(`bucketname`).id \>= $startkey\",\"client_context_id\":\"9c00aeff-43eb-40e3-a130-4f53c4a79b3b\",\"errors\":[{\"Code\":3000,\"Message\":\"Ambiguous reference to field ipc-20002-prod.\"}]}" }
       
      

      The query
      SELECT META(`bucketname`).id
      FROM `bucketname` USE INDEX(sg_syncDocs_x1)
      WHERE META(`bucketname`).id LIKE '
      _sync:%'
      AND (META(`bucketname`).id LIKE '
      _sync:user:%'
      OR META(`bucketname`).id LIKE '
      _sync:role:%')
      ORDER BY META(`bucketname`).id
      LIMIT 5000
      AND META(`bucketname`).id >= $startkey
      is malformed (if last "AND" condition is properly moved within the WHERE clause, it works).

      Attachments

        Issue Links

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

          Activity

            People

              adamf Adam Fraser
              ben.brooks Ben Brooks
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty