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

Query not accepting named params passed from js-evaluator

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not a Bug
    • Critical
    • None
    • 7.1.0
    • js-evaluator, query
    • None
    • Untriaged
    • 1
    • Unknown

    Description

      Please refer to the following patch where the javascript runner is correctly passing named arguments of type udf.Value to context.OpenStatement() as per contract:

      http://review.couchbase.org/c/eventing-ee/+/164329

      • The call to OpenStatement does not return error which means query has been prepared and registered.
      • However, when we call handle.NextDocument() query returns the following error:

      Evaluator error Exceptions from JS code : run queryselect failed:\nException: Error: Error evaluating LIMIT - cause: No value for named parameter $boolval (near line 1, column 36).
      

      This can also be reproduced via the following:

      Create a new Javascript UDF with the following definition:

      function queryselect(rowlimit) {
          var query = SELECT * from `travel-sample` LIMIT $rowlimit;
          var acc = [];
          for (const row of query) {
              acc.push(row);
          }
          return acc;
      }
      

      Create a function as follows:

      create function math2queryselect(rowlimit) language javascript as "queryselect" at "math2";
      

      And execute this statement:

      EXECUTE FUNCTION math2queryselect(100);
      

      Error:

      No value for named parameter $rowlimit

      Attachments

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

        Activity

          People

            abhishek.jindal Abhishek Jindal
            abhishek.jindal Abhishek Jindal
            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