Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IN (<value list>) operator broken #93

Closed
jaypipes opened this issue Apr 22, 2018 · 0 comments
Closed

IN (<value list>) operator broken #93

jaypipes opened this issue Apr 22, 2018 · 0 comments
Labels
Milestone

Comments

@jaypipes
Copy link
Owner

jaypipes commented Apr 22, 2018

Somewhere along the line, the IN (value list) operator was broken:

jaypipes@uberbox:~/src/github.com/jaypipes/sqltoast/_build$ ./sqltoaster/sqltoaster "SELECT * FROM t1 WHERE a IN (1, 2)"
Syntax error.
Expected to find ')' but found literal[2]
SELECT * FROM t1 WHERE a IN (1, 2)
                               ^^^
(took 40869 nanoseconds)
jaypipes@uberbox:~/src/github.com/jaypipes/sqltoast/_build$ ./sqltoaster/sqltoaster "SELECT * FROM t1 WHERE a IN (1)"
Syntax error.
Expected to find ')' but found symbol[EOS]
SELECT * FROM t1 WHERE a IN (1)
                              ^
(took 45609 nanoseconds)

The IN (subquery) operator works just fine though:

jaypipes@uberbox:~/src/github.com/jaypipes/sqltoast/_build$ ./sqltoaster/sqltoaster "SELECT * FROM t1 WHERE a IN (SELECT b FROM t2)"
OK
statements[0]:
  <statement: SELECT
   selected columns:
     0: *
   referenced tables:
     0: t1
   where:
     column-reference[a] IN <statement: SELECT
   selected columns:
     0: column-reference[b]
   referenced tables:
     0: t2>
>

(took 31314 nanoseconds)
@jaypipes jaypipes added the bug label Apr 22, 2018
@jaypipes jaypipes added this to the 0.2 milestone Apr 22, 2018
jaypipes added a commit that referenced this issue Apr 22, 2018
A stray call to advance the lexer after parsing a value expression was
causing the IN (<value list>) operator to fail parsing. This patch fixes
that issue and adds tests to prevent regressions in the future.

Fixes Issue #93
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant