About com.clickhouse.jdbc.internal.SqlParser Parsing error
Expected Behaviour
The number of parameters parsed normally should be 1, while the number of parameters currently parsed is 0
This will cause java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0 to appear when using alter
Code Example
@Test
void test() {
SqlParser sqlParser = new SqlParser();
System.out.println(sqlParser.parsePreparedStatement("alter table user delete where reg_time = ?").getArgCount());
}
Environment
- Client version: 0.9.0
@livk-cloud thank you for reporting! We will look into this.
The same out of bounds exception happens when using the Flyway integration. The queries used to check if the database exists get parsed with zero arguments:
SELECT COUNT() FROM system.databases WHERE name = ?
https://github.com/flyway/flyway-community-db-support/blob/main/flyway-database-clickhouse/src/main/java/org/flywaydb/community/database/clickhouse/ClickHouseSchema.java#L41