Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-48266

Array Index WHEN clause and query named parameters not working

    XMLWordPrintable

Details

    • Untriaged
    • 1
    • Yes

    Description

      create index ix1 on default(DISTINCT ARRAY v.lname FOR v IN names WHEN v.mname = "abc" END);
      EXPLAIN SELECT 1 FROM default WHERE ANY v IN names SATISFIES v.lname = "xyz" AND  v.mname = "abc" END;  -- works
      cbq> \set -$mname  "abc";
      cbq> EXPLAIN SELECT 1 FROM default WHERE ANY v IN names SATISFIES v.lname = "xyz" AND  v.mname = $mname END;
      {
          "requestID": "adc9c3a6-4904-492c-a15b-94c6b3cca802",
          "errors": [
              {
                  "code": 4000,
                  "msg": "No index available on keyspace default that matches your query. Use CREATE INDEX or CREATE PRIMARY INDEX to create an index, or check that your expected index is online."
              }
          ],
          "status": "fatal",
          "metrics": {
              "elapsedTime": "2.189019ms",
              "executionTime": "2.021909ms",
              "resultCount": 0,
              "resultSize": 0,
              "errorCount": 1
          }
      }
      
      

      last one is adhoc = true, If when clause value is parameterized it is not working. In adhoc=true we suppose to replace parameter with value before index selection.

      Looks like some case is missed in MB-33009

      Attachments

        Issue Links

          Activity

            People

              pierre.regazzoni Pierre Regazzoni
              Sitaram.Vemulapalli Sitaram Vemulapalli
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                PagerDuty