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

N1QL: Merge query giving Invalid merge key msg on missing keys and keys with null values

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Major
    • 4.1.0
    • 4.1.0
    • query
    • Security Level: Public
    • None
    • Darwin
    • Untriaged
    • MacOSX 64-bit
    • No

    Description

      1.Add `beer-sample` as a sample bucket.
      2.Create a new bucket default.
      3.Execute the following query:
      merge into default using `beer-sample` on key `beer-sample`.`state` when matched then update set default.name="abc",default.age=21;
      OR
      merge into default using `beer-sample` on key to_string(`beer-sample`.`state`) when matched then update set default.name="abc",default.age=21;

      Result:
      {
      "requestID": "88d4b52c-ace4-43c1-9eb4-e19b93a9cc7f",
      "signature": null,
      "results": [
      ],
      "errors": [

      { "code": 5030, "msg": "Invalid MERGE key \u003cnil\u003e of type \u003cnil\u003e." }

      ],
      "status": "errors",
      "metrics":

      { "elapsedTime": "16.548202ms", "executionTime": "16.390232ms", "resultCount": 0, "resultSize": 0, "errorCount": 1 }

      }

      We get this error because some documents in beer-sample have value of state key as null or do not have state key.
      It should ideally skip those docs.
      Tried another test case with merge on missing/null value key and I get the same error message.
      This query works fine if merge key has empty/not matching values.

      Attachments

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

        Activity

          People

            gerald Gerald Sangudi (Inactive)
            Prerna.Manaktala Prerna Manaktala (Inactive)
            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