druid PostgreSQL解析报错-CREATE INDEX

4si2a6ki  于 2021-11-27  发布在  Java
关注(0)|答案(0)|浏览(412)

使用SQLUtils解析SQL,出现错误

public static void main(String[] args) {
        String sql = "CREATE INDEX \"idx_name_status\" ON \"public\".\"t_user\" USING btree (\n" +
                "  \"name\" COLLATE \"pg_catalog\".\"default\" \"pg_catalog\".\"text_ops\" ASC NULLS LAST,\n" +
                "  \"status\" \"pg_catalog\".\"int2_ops\" ASC NULLS LAST\n" +
                ");";
        SQLUtils.parseStatements(sql, JdbcConstants.POSTGRESQL);
    }

错误信息

Exception in thread "main" com.alibaba.druid.sql.parser.ParserException: syntax error, error in :'ame" COLLATE "pg_catalog"."default"', expect RPAREN, actual IDENTIFIER pos 82, line 2, column 10, token IDENTIFIER COLLATE
	at com.alibaba.druid.sql.parser.SQLParser.printError(SQLParser.java:344)
	at com.alibaba.druid.sql.parser.SQLParser.accept(SQLParser.java:352)
	at com.alibaba.druid.sql.dialect.postgresql.parser.PGSQLStatementParser.parseCreateIndex(PGSQLStatementParser.java:639)
	at com.alibaba.druid.sql.parser.SQLStatementParser.parseCreate(SQLStatementParser.java:2165)
	at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:260)
	at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:171)
	at com.alibaba.druid.sql.SQLUtils.parseStatements(SQLUtils.java:492)
	at com.alibaba.druid.sql.SQLUtils.parseStatements(SQLUtils.java:487)
<dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid</artifactId>
            <version>1.1.22</version>
</dependency>

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题