sqld icon indicating copy to clipboard operation
sqld copied to clipboard

Query strings that don't contain a SQL statement yields error "not an error"

Open CodingDoug opened this issue 3 years ago • 0 comments

Issuing a query that is either

  1. am empty string

  2. a whitespace-only string

  3. a comment with no statement

    For example:

    -- hello
    

    or

    /* hello */
    

yields an error response:

  {
    "error": {
      "message": "not an error"
    }
  }
]

This does not happen with strings that have an actual statement in them, along with comments. These are OK:

select * from foo  -- hello
/* hello */ select * from foo

I'm not certain what is the best response here. I would find it acceptable if there is an error code that goes along with the error object so that the caller can detect this situation (that nothing happened) without having to parse a string message to know that. The error message would then need to be something more accurate, such as "no statement executed".

CodingDoug avatar Mar 01 '23 01:03 CodingDoug