Skip to content

Robustify syntax error reporting #92

@jaypipes

Description

@jaypipes

Due the various things, including how the lexer's cursor is moved over time, sometimes the syntax errors produced when a parsing problem happens can be confusing. Por ejemplo:

./sqltoaster/sqltoaster "SELECT NULLIF(a, b) FROM t1"
OK
statements[0]:
  <statement: SELECT
   selected columns:
     0: nullif[column-reference[a],column-reference[b]]
   referenced tables:
     0: t1>

(took 73006 nanoseconds)

If I remove the a,b arguments accidentally, I get the following parser syntax error:

./sqltoaster/sqltoaster "SELECT NULLIF() FROM t1"
Syntax error.
Expected to find one of ('*'|<< identifier >>) but found symbol[')']
SELECT NULLIF() FROM t1
             ^^^^^^^^^^
(took 78092 nanoseconds)

What should be there is a message about how a is expected as the first argument to the NULLIF() function.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions