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

backslash in like expression causes query engine panic

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 4.6.0, 5.0.0
    • 4.5.1, 5.0.0
    • query
    • None
    • Untriaged
    • Unknown

    Description

       
      create index ix100 on default(x) where y like "abc%";
      select x from default where x > 20 and y like \"abc%\";
      {
          "requestID": "9233dd9c-d0a1-4634-8bcd-19a3c75b674c",
          "errors": [
              {
                  "code": 3000,
                  "msg": "Error while parsing: runtime error: index out of range - at end of input"
              }
          ],
       
       
      select x from default where x > 20 and y like "abc%";
      {
          "requestID": "e4b7cbd1-e223-4ce6-8e1a-731e4d872db1",
          "signature": {
              "x": "json"
          },
          "results": [
          ],
          "status": "success",
          "metrics": {
              "elapsedTime": "7.467416ms",
              "executionTime": "7.441074ms",
              "resultCount": 0,
              "resultSize": 0
          }
      }
       
       
      create index ix101 on default(x);
      explain select x from default where x like "";
      {
          "requestID": "672aa1fa-22c2-41fc-8279-33cd58912475",
          "errors": [
              {
                  "code": 3000,
                  "msg": "Error while parsing: runtime error: index out of range - at end of input"
              }
          ],
          "status": "fatal",
          "metrics": {
              "elapsedTime": "2.548857ms",
              "executionTime": "2.52828ms",
              "resultCount": 0,
              "resultSize": 0,
              "errorCount": 1
          }
      }
      

      _time=2016-08-01T20:56:13.453-07:00 _level=ERROR _msg=Error while parsing: runtime error: index out of range
      goroutine 67 [running]:
      github.com/couchbase/query/parser/n1ql.doParse.func1(0xc820d83f20)
      /Users/sitaram/query/src/github.com/couchbase/query/parser/n1ql/n1ql.go:69 +0x273
      github.com/couchbase/query/expression.likeCompile(0x0, 0x0, 0x0, 0xc8200b2460, 0x0, 0x0)
      /Users/sitaram/query/src/github.com/couchbase/query/expression/comp_like.go:140 +0x221
      github.com/couchbase/query/expression.(*Like).precompile(0xc8206a3200)
      /Users/sitaram/query/src/github.com/couchbase/query/expression/comp_like.go:116 +0x15f
      github.com/couchbase/query/expression.NewLike(0x647d3f8, 0xc82057a180, 0x64b9dc8, 0xc82041d3e0, 0x0, 0x0)
      /Users/sitaram/query/src/github.com/couchbase/query/expression/comp_like.go:39 +0x1ce
      github.com/couchbase/query/parser/n1ql.(*yyParserImpl).Parse(0xc820a2a0d8, 0x6478660, 0xc820d83f20, 0x0)
      n1ql.y:2083 +0x1fdb0
      github.com/couchbase/query/parser/n1ql.yyParse(0x6478660, 0xc820d83f20, 0xc820d83f20)
      yaccpar:154 +0x49
      github.com/couchbase/query/parser/n1ql.doParse(0xc820d83f20)
      /Users/sitaram/query/src/github.com/couchbase/query/parser/n1ql/n1ql.go:74 +0x73
      github.com/couchbase/query/parser/n1ql.ParseStatement(0xc820d52680, 0x36, 0x0, 0x0, 0x0, 0x0)
      /Users/sitaram/query/src/github.com/couchbase/query/parser/n1ql/n1ql.go:29 +0x21a
      github.com/couchbase/query/server.(*Server).getPrepared(0xc8202b0b40, 0x6478470, 0xc8203e85a0, 0x4d850c8, 0x7, 0x0, 0x0, 0x0)
      /Users/sitaram/query/src/github.com/couchbase/query/server/server.go:474 +0xd6
      github.com/couchbase/query/server.(*Server).serviceRequest(0xc8202b0b40, 0x6478470, 0xc8203e85a0)
      /Users/sitaram/query/src/github.com/couchbase/query/server/server.go:408 +0xea
      github.com/couchbase/query/server.(*Server).doServe(0xc8202b0b40)
      /Users/sitaram/query/src/github.com/couchbase/query/server/server.go:355 +0x134
      created by github.com/couchbase/query/server.(*Server).Serve
      /Users/sitaram/query/src/github.com/couchbase/query/server/server.go:345 +0x84

      Attachments

        Issue Links

          Activity

            People

              Sitaram.Vemulapalli Sitaram Vemulapalli
              Sitaram.Vemulapalli Sitaram Vemulapalli
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                PagerDuty