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

N1QL: Unused JOIN causes query engine to panic

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • 5.1.0
    • 4.6.3
    • query
    • None

    Description

      Problem

      If doing a join in a query, and none of the joined fields are selected then the query engine panics and crashes. This should not happen as the query is still valid, there is just unused information.

      For example, the query:

      SELECT testA.field fieldA
      FROM testA 
      JOIN testB testB on key testB.testA_ID for testA 
      WHERE true AND testA.foo.bar IN [5]

      causes the query engine to return:

      [
        {
          "code": 5001,
          "msg": "Panic: runtime error: invalid memory address or nil pointer dereference - cause: runtime error: invalid memory address or nil pointer dereference"
        }
      ]

      Where as having the query as:

      SELECT testA.field fieldA, testB.field fieldB
      FROM testA 
      JOIN testB testB on key testB.testA_ID for testA 
      WHERE true AND testA.foo.bar IN [5]

      will work just fine.

      Expectation

      Both queries should work and return the specified data, regardless of the fact the JOIN isn't used in the first one.

      Attachments

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

        Activity

          People

            bingjie.miao Bingjie Miao
            tim.bradgate Tim Bradgate (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty