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
parser sql of MySQL create or alter table with partition occur exception #1668
Hi:
when use JSqlParser to parse sql then occur exception
Test create table ddl with range partition code like blew:
@test
public void test_CreateTablePartition() throws JSQLParserException {
String sqlString = "CREATE TABLE t1 (\n"
+ " id INT,\n"
+ " year_col INT\n"
+ ")\n"
+ "PARTITION BY RANGE (year_col) (\n"
+ " PARTITION p0 VALUES LESS THAN (1991),\n"
+ " PARTITION p1 VALUES LESS THAN (1995),\n"
+ " PARTITION p2 VALUES LESS THAN (1999)\n"
+ ");";
Statement statement = CCJSqlParserUtil.parse(sqlString);
}
Exception like blew:
Caused by: java.util.concurrent.ExecutionException: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "RANGE" "RANGE"
at line 5, column 14.
Was expecting one of:
";"
"AS"
"DISABLE"
"ENABLE"
"LIKE"
<EOF>
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:206)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatement(CCJSqlParserUtil.java:258)
... 74 more
Caused by: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "RANGE" "RANGE"
at line 5, column 14.
Was expecting one of:
";"
"AS"
"DISABLE"
"ENABLE"
"LIKE"
<EOF>
at net.sf.jsqlparser.parser.CCJSqlParser.generateParseException(CCJSqlParser.java:33398)
at net.sf.jsqlparser.parser.CCJSqlParser.jj_consume_token(CCJSqlParser.java:33231)
at net.sf.jsqlparser.parser.CCJSqlParser.Statement(CCJSqlParser.java:167)
at net.sf.jsqlparser.parser.CCJSqlParserUtil$1.call(CCJSqlParserUtil.java:253)
at net.sf.jsqlparser.parser.CCJSqlParserUtil$1.call(CCJSqlParserUtil.java:250)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)
Test alter table ddl with range partition code like blew:
@test
public void test_alterTablePartition() throws JSQLParserException {
String sqlString = "ALTER TABLE t1 ADD PARTITION (PARTITION p3 VALUES LESS THAN (2002))";
Statement statement = CCJSqlParserUtil.parse(sqlString);
}
`
Exception blew:
Caused by: java.util.concurrent.ExecutionException: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "(" "("
at line 1, column 30.
Was expecting:
"COMMENT"
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:206)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatement(CCJSqlParserUtil.java:258)
... 74 more
Caused by: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "(" "("
at line 1, column 30.
PARTITION is not supported/implemented for both CREATE TABLE and ALTER TABLE statements.
Please either send a PR or sponsor an implementation, when you are interested in this feature.
Activity
manticore-projects commentedon Nov 17, 2022
Greetings.
PARTITIONis not supported/implemented for bothCREATE TABLEandALTER TABLEstatements.Please either send a PR or sponsor an implementation, when you are interested in this feature.