Describe the bug
Using jdbc v8
If the INSERT statement does not contain VALUES keyword during the PreparedStatement query creation, the insert fails due to syntax error.
Issue seems to be due to the the constructor doing a substring.
|
valueSegments = originalSql.substring(originalSql.indexOf("VALUES") + 6).split("\\?"); |
Any possibility that this will be changed as I would like to use other insert statements like insert into select from or using format json
Steps to reproduce
- Create a preparedStatement that does not contain VALUES
- Add paremeters required
- Execute PS
Expected behaviour
Inserts without error
Code example
String query = "INSERT INTO persons FORMAT JSON { 'name': 'Example' }";
final PreparedStatement preparedStatement = con.prepareStatement(query);
preparedStatement.execute()
Error log
Configuration
Environment
- Client version: clickhouse-jdbc 0.8.2.
- Language version: Java 21
- OS: macOS
ClickHouse server
- ClickHouse Server version: 25.1.1.4165
- ClickHouse Server non-default settings, if any:
CREATE TABLE statements for tables involved:
- Sample data for all these tables, use clickhouse-obfuscator if necessary
Describe the bug
Using jdbc v8
If the INSERT statement does not contain VALUES keyword during the PreparedStatement query creation, the insert fails due to syntax error.
Issue seems to be due to the the constructor doing a substring.
clickhouse-java/jdbc-v2/src/main/java/com/clickhouse/jdbc/PreparedStatementImpl.java
Line 75 in 861fd5b
Any possibility that this will be changed as I would like to use other insert statements like insert into select from or using format json
Steps to reproduce
Expected behaviour
Inserts without error
Code example
Error log
Configuration
Environment
ClickHouse server
CREATE TABLEstatements for tables involved: