-
Notifications
You must be signed in to change notification settings - Fork 614
Closed
Labels
Milestone
Description
High Level Area Labels:
- jdbc-v2
Specific Area Labels:
- sql-parser
Description
Steps to reproduce
- Create parameterized view
- Make prepared statement with query to parameterized view
- Run prepared statement
Error Log or Exception StackTrace
-- version 0.8.6
line 1:37 no viable alternative at input 'SELECTresultFROMtest_view(myParam='
-- version 0.9.1
SQL syntax error at line: 1, pos: 37, no viable alternative at input 'SELECTresultFROMtest_view(myParam='
Expected Behaviour
Code Example
String url = "jdbc:clickhouse://localhost:8123";
Properties properties = new Properties();
properties.setProperty("user", "user");
properties.setProperty("password", "password");
properties.setProperty("database", "default");
Connection connection = DriverManager.getConnection(url, properties);
// Creating view
Statement stmt = connection.createStatement()
stmt.execute("CREATE VIEW test_view AS SELECT {myParam:DateTime64(3)} as result");
// Prepare query to the view
PreparedStatement ps = conn.prepareStatement("SELECT result FROM test_view(myParam = ?)");
Instant expected = Instant.parse("2025-08-14T12:30:00.390Z");
LocalDateTime ldt = LocalDateTime.ofInstant(now, ZoneOffset.UTC);
ps.setObject(1, ldt);
ResultSet resultSet = ps.executeQuery();
resultSet.next();
Instant actual = ((java.sql.Timestamp)resultSet.getObject("result")).toInstant();
System.out.println(actual);Environment
- Cloud
- Client version: 0.8.6, 0.9.1
- Language version: openjdk version "21.0.8" 2025-07-15
- OS: Max OS 15.6
ClickHouse Server
- ClickHouse Server version: 25.3.4