From 298c2abdf0cf4d1fe7aee8bb56d3adedb91956be Mon Sep 17 00:00:00 2001 From: Ray Date: Mon, 10 May 2021 16:13:16 +0800 Subject: [PATCH] In the addBatch method, add parsedStmt.hasValues() check to ensure that the query of the form 'INSERT INTO ... SELECT' will be executed --- .../ru/yandex/clickhouse/ClickHousePreparedStatementImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clickhouse-jdbc/src/main/java/ru/yandex/clickhouse/ClickHousePreparedStatementImpl.java b/clickhouse-jdbc/src/main/java/ru/yandex/clickhouse/ClickHousePreparedStatementImpl.java index 4abb48f95..66b243740 100644 --- a/clickhouse-jdbc/src/main/java/ru/yandex/clickhouse/ClickHousePreparedStatementImpl.java +++ b/clickhouse-jdbc/src/main/java/ru/yandex/clickhouse/ClickHousePreparedStatementImpl.java @@ -327,7 +327,7 @@ public void addBatch(String sql) throws SQLException { @Override public void addBatch() throws SQLException { - if (parsedStmt.getStatementType() == StatementType.INSERT) { + if (parsedStmt.getStatementType() == StatementType.INSERT && parsedStmt.hasValues()) { batchRows.addAll(buildBatch()); } else { batchStmts.add(buildSql());