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

Error while parsing alter table max_rows or min_rows in mysql #714

Closed
1987bishop opened this issue Nov 20, 2018 · 4 comments
Closed

Error while parsing alter table max_rows or min_rows in mysql #714

1987bishop opened this issue Nov 20, 2018 · 4 comments

Comments

@1987bishop
Copy link

like this:
alter table abc max_rows = 1000;

jsqlparser code:
String result = SQLUtils.format(sql, dbType);
System.out.println(result);
Statements stmts = CCJSqlParserUtil.parseStatements("alter table abc max_rows = 1000;");
List stmtList = stmts.getStatements();

    System.out.println("size is:" + stmtList.size());
    for (int i = 0; i < stmtList.size(); i++) {

        Statement stmt = stmtList.get(i);

        TablesNamesFinder tablesNamesFinder = new TablesNamesFinder();
        List<String> tableList = tablesNamesFinder.getTableList(stmt);

        System.out.println("Tables : " + tableList);
    }

exception:
Exception in thread "main" net.sf.jsqlparser.JSQLParserException
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatements(CCJSqlParserUtil.java:154)
at com.netease.backend.rds.websql.test.rds.TestDruid.main(TestDruid.java:34)
Caused by: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "max_rows" <S_IDENTIFIER>
at line 1, column 17.

Was expecting one of:

"ADD"
"DROP"
"MODIFY"

at net.sf.jsqlparser.parser.CCJSqlParser.generateParseException(CCJSqlParser.java:18597)
at net.sf.jsqlparser.parser.CCJSqlParser.jj_consume_token(CCJSqlParser.java:18447)
at net.sf.jsqlparser.parser.CCJSqlParser.AlterExpression(CCJSqlParser.java:11652)
at net.sf.jsqlparser.parser.CCJSqlParser.AlterTable(CCJSqlParser.java:11665)
at net.sf.jsqlparser.parser.CCJSqlParser.SingleStatement(CCJSqlParser.java:157)
at net.sf.jsqlparser.parser.CCJSqlParser.Statements(CCJSqlParser.java:430)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatements(CCJSqlParserUtil.java:152)
... 1 more

Caused by:
net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "max_rows" <S_IDENTIFIER>
at line 1, column 17.

Was expecting one of:

"ADD"
"DROP"
"MODIFY"

at net.sf.jsqlparser.parser.CCJSqlParser.generateParseException(CCJSqlParser.java:18597)
at net.sf.jsqlparser.parser.CCJSqlParser.jj_consume_token(CCJSqlParser.java:18447)
at net.sf.jsqlparser.parser.CCJSqlParser.AlterExpression(CCJSqlParser.java:11652)
at net.sf.jsqlparser.parser.CCJSqlParser.AlterTable(CCJSqlParser.java:11665)
at net.sf.jsqlparser.parser.CCJSqlParser.SingleStatement(CCJSqlParser.java:157)
at net.sf.jsqlparser.parser.CCJSqlParser.Statements(CCJSqlParser.java:430)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatements(CCJSqlParserUtil.java:152)
@wumpz
Copy link
Member

wumpz commented Nov 22, 2018

Out of curiosity. What does this do?

"alter table abc max_rows = 1000;"

Is max_rows a table property?

@1987bishop
Copy link
Author

When you create a MyISAM table, MySQL uses the product of the MAX_ROWS and AVG_ROW_LENGTH options to decide how big the resulting table is.

@1987bishop
Copy link
Author

@manticore-projects
Copy link
Contributor

See UnsupportedStatements as explain in #1945 (unless you will sponsor or provide a specific implementation of this feature.)

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

No branches or pull requests

3 participants