[tarantool-patches] Re: [PATCH v2 2/5] sql: rework syntax errors

Konstantin Osipov kostja at tarantool.org
Tue Feb 26 16:12:17 MSK 2019

* n.pettik <korablev at tarantool.org> [19/02/26 16:02]:
> > Yes, the name is suggested by me. There is a name clash with a
> > generic ER_SYNTAX_ERROR.
> I don’t see problem here. First error is “Syntax error in %s : %s”.
> For instance, “Syntax error in trigger body : blah-blah”.
> Second one is “Syntax error near %s” or “Syntax error near %s token”.
> For instance, “Syntax error near “create” token.”
> Ok, if you still want to use ’syntax’ word, then at least let’s use
> this variant: “Incorrect syntax near %s"
> I failed to find any compiler or db which generate
> “Unrecognized syntax …” error messages.

Ok, if you ask me what's better - syntax error vs. unrecognized
syntax - up to you, it doesn't really matter.

Let's ensure two properties:
- the grammar and punctuation are correct
- the message is as specific as possible, i.e. allows the user to
  easily identify location of the error. Don't assume there is a
  single-line statement, assume 1 select statement can easily be
  200 lines of highly nested code.

> > I also requested to add line/character
> > numbers to the error message, which I don't see in the patch.
> Line is useless now, we don’t have multi-line processing.

We do.

tarantool> box.sql.execute("select\n\n\n1")
- - [1]

Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.io - www.twitter.com/kostja_osipov

More information about the Tarantool-patches mailing list