You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] JSQLParser Version : MySQL 8.x : Drop and add index SQL parse error #2369
Always check against the Latest SNAPSHOT of JSQLParser and the Syntax Diagram
Failing SQL Feature:
Drop and add index SQL parse error
SQL Example:
Simplified Query Example, focusing on the failing feature
ALTERTABLE`wxp_dm`.`xqgl_req_report`s
DROPINDEX`index_name`,
ADD UNIQUE INDEX `index_name`(`report_name`ASC) USING BTREE;
Error Message:
Caused by: net.sf.jsqlparser.JSQLParserException: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "ASC" "ASC"
at line 3, column 46.
Was expecting one of:
")"
","
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatement(CCJSqlParserUtil.java:352)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:125)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:91)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:64)
at com.wxp.dm.utils.MysqlToDmUtils.alterTableSql(MysqlToDmUtils.java:690)
... 4 more
Caused by: java.util.concurrent.ExecutionException: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "ASC" "ASC"
at line 3, column 46.
Was expecting one of:
")"
","
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:205)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatement(CCJSqlParserUtil.java:345)
... 8 more
Caused by: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "ASC" "ASC"
at line 3, column 46.
Was expecting one of:
")"
","
at net.sf.jsqlparser.parser.CCJSqlParser.generateParseException(CCJSqlParser.java:53111)
at net.sf.jsqlparser.parser.CCJSqlParser.jj_consume_token(CCJSqlParser.java:52929)
at net.sf.jsqlparser.parser.CCJSqlParser.ColumnsNamesList(CCJSqlParser.java:28854)
at net.sf.jsqlparser.parser.CCJSqlParser.AlterExpression(CCJSqlParser.java:30776)
at net.sf.jsqlparser.parser.CCJSqlParser.AlterTable(CCJSqlParser.java:32492)
at net.sf.jsqlparser.parser.CCJSqlParser.Alter(CCJSqlParser.java:32406)
at net.sf.jsqlparser.parser.CCJSqlParser.SingleStatement(CCJSqlParser.java:547)
at net.sf.jsqlparser.parser.CCJSqlParser.Statement(CCJSqlParser.java:413)
I solved this problem with minimal changes dengliming@f43531b, but not sure if this is the best solution, I see have introduced ColumnNamesWithParamsList before this, if unified use this, the change place is large and has a risk, can you help me look at it? @manticore-projects
@dengliming: In my opinion, we need to rework the ALTER TABLE ... stuff completely although I have very little interest in parsing DDL statements.
So in my opinion, the approach of "minimal changes" here is good enough since ALTER TABLE ... is a big mess already and any more work around won't harm it more.
Activity
dengliming commentedon Feb 24, 2026
I solved this problem with minimal changes dengliming@f43531b, but not sure if this is the best solution, I see have introduced
ColumnNamesWithParamsListbefore this, if unified use this, the change place is large and has a risk, can you help me look at it? @manticore-projectsmanticore-projects commentedon Feb 24, 2026
@dengliming: In my opinion, we need to rework the
ALTER TABLE ...stuff completely although I have very little interest in parsing DDL statements.So in my opinion, the approach of "minimal changes" here is good enough since
ALTER TABLE ...is a big mess already and any more work around won't harm it more.