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

Query: improve readability of syntax errors

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Duplicate
    • Major
    • 7.1.0
    • 5.5.2
    • query
    • None

    Description

      Query with syntax error:

      select * from `travel-sample` where meta().id like 10* and id is not null and type is not missing;

      error:

       

       

      [
        {
          "code": 3000,
          "msg": "syntax error - at and",
          "query_from_user": "select * from `travel-sample` where meta().id like 10* and id is not null and type is not missing;"
        }
      ]

       

      Even in this simple query, you can start to see how it's hard to figure out which 'and' is the problem.

       

      A few simple suggestions to improve:

      1 - Change the msg so that it's clearer what the problem word is.  In the above example, reading it would seem to indicate that the "at and" is the problem, when in reality it's just the "and".  Suggestion to either put single quotes around the 'and', or to remove the "at" and just have "syntax error: and"

      2 - Add a character count.  I.e. "syntax error at character 56: and"

      3 - Provide more context around the problem word.  i.e. "syntax error: ...and id is not null and type is not missing;" or "select * from `travel-sample` where meta().id like 10*<error> and id is not null and type is not missing;" (or replace <error> with something indicative like a '^', etc)

       

      Attachments

        Issue Links

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

          Activity

            People

              Donald.haggart Donald Haggart
              perry Perry Krug
              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