Skip to content

Unexpected token: apply #1148

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

Closed
Fioooooooo opened this issue Apr 7, 2021 · 3 comments · Fixed by #1382
Closed

Unexpected token: apply #1148

Fioooooooo opened this issue Apr 7, 2021 · 3 comments · Fixed by #1382

Comments

@Fioooooooo
Copy link

Describe the bug
There is a sql which i can run with mysql success, but if with jsqlparser, got an exception

To Reproduce
Steps to reproduce the behavior:

  1. Example SQL
 SELECT  remark,apply FROM oms_data
  1. Exception Log
2021-04-07 09:55:02.471  WARN 41488 --- [nio-8080-exec-1] c.b.m.e.p.i.PaginationInnerInterceptor   : optimize this sql to a count sql has exception, sql:"SELECT  
remark,apply
  FROM oms_data", exception:
net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "apply" "APPLY"
    at line 2, column 8.

Was expecting one of:

    "!"
    "("
    "*"
    "+"
    "-"
    ":"
    "?"
    "@"
    "@@"
    "ACTION"
    "ANY"
    "BYTE"
    "CASCADE"
    "CASE"
    "CAST"
    "CHANGE"
    "CHAR"
    "CHARACTER"
    "COLUMN"
    "COLUMNS"
    "COMMENT"
    "COMMIT"
    "CREATE"
    "CURRENT"
    "CYCLE"
    "DESCRIBE"
    "DISABLE"
    "DO"
    "DOUBLE"
    "DUPLICATE"
    "ENABLE"
    "END"
    "EXTRACT"
    "FALSE"
    "FIRST"
    "FN"
    "FOLLOWING"
    "GROUP"
    "GROUP_CONCAT"
    "IF"
    "IIF"
    "INDEX"
    "INSERT"
    "INTERVAL"
    "ISNULL"
    "KEY"
    "LAST"
    "LEFT"
    "LIMIT"
    "MATCH"
    "MATERIALIZED"
    "NEXTVAL"
    "NO"
    "NOLOCK"
    "NOT"
    "NULL"
    "NULLS"
    "OFFSET"
    "ON"
    "OPEN"
    "OPTIMIZE"
    "ORDER"
    "OVER"
    "PARTITION"
    "PATH"
    "PERCENT"
    "PRECISION"
    "PRIMARY"
    "PRIOR"
    "PROCEDURE"
    "RANGE"
    "READ"
    "REPLACE"
    "RIGHT"
    "ROW"
    "ROWS"
    "SCHEMA"
    "SEPARATOR"
    "SESSION"
    "SET"
    "SIBLINGS"
    "SIZE"
    "START"
    "TABLE"
    "TEMP"
    "TEMPORARY"
    "TOP"
    "TRUE"
    "TRUNCATE"
    "TYPE"
    "UNSIGNED"
    "VALIDATE"
    "VALUE"
    "VALUES"
    "VIEW"
    "XML"
    "ZONE"
    "{"
    "{d"
    "{t"
    "{ts"
    "~"
    <K_DATETIMELITERAL>
    <K_DATE_LITERAL>
    <K_TIME_KEY_EXPR>
    <S_CHAR_LITERAL>
    <S_DOUBLE>
    <S_HEX>
    <S_IDENTIFIER>
    <S_LONG>
    <S_QUOTED_IDENTIFIER>

Expected behavior
A clear and concise description of what you expected to happen.

System

  • Database you are using: MySQL 5.6.16
  • Java Version: Oracle 1.8.0_251
  • JSqlParser version: 3.2
@Fioooooooo
Copy link
Author

There is also has the exception when i update JSqlParser vertion to 4.0

@wumpz
Copy link
Member

wumpz commented Apr 10, 2021

apply is a keyword. I checked to adapt the grammar to allow apply as a column name. Unfortunately this is not trivial.

@manticore-projects
Copy link
Contributor

Fixed by PR #1382

You can test it online and interactively here.

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

Successfully merging a pull request may close this issue.

3 participants