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

improve N1QL query syntax error messages

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Done
    • Major
    • feature-backlog
    • 4.5.0, 4.6.0, 5.0.0, 6.0.0, 6.6.0, 6.5.0
    • query

    Description

      N1QL query error messages are not very useful in identifying or fixing a problem in the query. Can we throw more useful syntax error messages. For ex: 

      1) select * from[ default;

      "code": 3000,
      "msg": "syntax error - at ;",
      "query_from_user": "select * from[ default;"

      2) select *, from default;

      "code": 3000,
      "msg": "syntax error - at from",
      "query_from_user": "select *, from default;"

      3) select * from default where type = "order" let x = name;

      "code": 3000,
      "msg": "syntax error - at let",
      "query_from_user": "select * from default where type = \"order\" let x = name;"

       

      Thoughts to improve these errors:

      ==========================

      1) print the line#,  col#, and the sample/surrounding text causing the syntax error. If line# &col# are not relevant, some way to identify the position# in the query text will be helpful.

      2) Any contextual suggestion to identify/fix the issue would be great. In example (3) above, why let clause is error, or  suggesting to move let-clause before where-clause.

      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
              Prasad.Varakur Prasad Varakur
              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