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

MySqlCreateTableParser.parseCreateTable token IDENTIFIER signed #4454

Closed
lwfcatch opened this issue Sep 13, 2021 · 0 comments
Closed

MySqlCreateTableParser.parseCreateTable token IDENTIFIER signed #4454

lwfcatch opened this issue Sep 13, 2021 · 0 comments
Labels
Milestone

Comments

@lwfcatch
Copy link

lwfcatch commented Sep 13, 2021

 public void test_idle2() throws Exception {
        Set<String> tablesSet = new HashSet<>();
        String sql = "CREATE TABLE `test_trigger` (\n" +
                "  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'trigger id',\n" +
                "  `test` int(11) signed NOT NULL DEFAULT '0' COMMENT 'trigger test',\n" +
                "  PRIMARY KEY (`id`)\n" +
                ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;";
        MySqlStatementParser parser = new MySqlStatementParser(sql);
        SQLStatement statement = parser.parseStatement();
        MySqlSchemaStatVisitor visitor = new MySqlSchemaStatVisitor();
        statement.accept(visitor);
        Map<TableStat.Name, TableStat> tableMap = visitor.getTables();
        for (Iterator iterator = tableMap.keySet().iterator(); iterator.hasNext(); ) {
            TableStat.Name name = (TableStat.Name) iterator.next();
            System.out.println(name.toString() + " - " + tableMap.get(name).toString());
        }
        System.out.println(1111);
    }

com.alibaba.druid.sql.parser.ParserException: syntax error, error in :'test int(11) signed NOT NULL DEFAULT '0' CO', expect ), actual null, pos 126, line 3, column 19, token IDENTIFIER signed

at com.alibaba.druid.sql.parser.SQLParser.printError(SQLParser.java:622)
at com.alibaba.druid.sql.parser.SQLParser.accept(SQLParser.java:630)
at com.alibaba.druid.sql.dialect.mysql.parser.MySqlCreateTableParser.parseCreateTable(MySqlCreateTableParser.java:370)
at com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser.parseCreate(MySqlStatementParser.java:309)
at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:249)
at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatement(SQLStatementParser.java:4557)
@wenshao wenshao closed this as completed in b7e0ce1 Oct 3, 2021
@wenshao wenshao added this to the 1.2.8 milestone Oct 3, 2021
@wenshao wenshao added the Bug label Oct 3, 2021
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

2 participants