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

named parameters cannot be found in JSON requests

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • cbq-DP4
    • 4.0.0
    • query
    • Security Level: Public
    • None
    • Untriaged
    • Unknown

    Description

      The way the JSON request is parsed, named parameters "keys" are not stripped of their $ prefix, contrary to what is done for Http parsing here https://github.com/couchbaselabs/query/blob/master/server/http/service_request.go#L473

      (see JSON named parameters parsing here: https://github.com/couchbaselabs/query/blob/master/server/http/service_request.go#L626)

      Since named parameters are detected by noticing a $ prefix in the JSON request body, this can't be worked around by just not prefixing.

      Possible workarounds at the moment are using positional parameters or using http url-form-encoded request mode...

      Attachments

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

        Activity

          Hi Colm,

          What is the issue here, and what is our solution?

          Also, why does this work for positional parameters and not named parameters?

          gerald Gerald Sangudi (Inactive) added a comment - Hi Colm, What is the issue here, and what is our solution? Also, why does this work for positional parameters and not named parameters?

          Hey Gerald,

          I'm not sure I understand what the issue is exactly, but I can start with a couple of tests and take it from there. For example the request 1 and 2 should be equivalent:

          1:

          { "statement": "select $name", "$name": "foo" }

          2:

          { "statement": "select $1", "args": [ "foo" ] }
          colm Colm Mchugh (Inactive) added a comment - Hey Gerald, I'm not sure I understand what the issue is exactly, but I can start with a couple of tests and take it from there. For example the request 1 and 2 should be equivalent: 1: { "statement": "select $name", "$name": "foo" } 2: { "statement": "select $1", "args": [ "foo" ] }

          commit d1a351d2e547d797e8478165fb8725aaf6c6107a

          colm Colm Mchugh (Inactive) added a comment - commit d1a351d2e547d797e8478165fb8725aaf6c6107a

          People

            colm Colm Mchugh (Inactive)
            simonbasle Simon Baslé (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty