-
Notifications
You must be signed in to change notification settings - Fork 614
Closed
Labels
Description
Description
In 0.8.6 a query with a CTE inside of a subquery fails. It worked with 0.8.4 and works with clickhouse-client.
Found while investigating metabase/metabase#59166
Steps to reproduce
-
Start a ClickHouse container
-
Start a Clojure repl with 0.8.6:
$ clj -Sdeps '{:deps {com.clickhouse/clickhouse-jdbc {:mvn/version "0.8.6"}}}' -
Execute the query
(let [sql "select * from ( with x as ( select 9 ) select * from x );"]
(with-open [conn (java.sql.DriverManager/getConnection "jdbc:clickhouse://localhost:8123" "default" "")
stmt (.createStatement conn)]
(.execute stmt sql)
(with-open [rs (.getResultSet stmt)]
(while (.next rs)
(println (.getObject rs 1))))))-
See that the query errors
-
The code in 3. works if 2. is done with
clj -Sdeps '{:deps {com.clickhouse/clickhouse-jdbc {:mvn/version "0.8.4"}}}'
Error Log or Exception StackTrace
line 2:11 no viable alternative at input 'select*from(withxas('
Execution error (NullPointerException) at user/eval166 (REPL:5).
Cannot invoke "java.sql.ResultSet.close()" because "rs" is null
Expected Behaviour
Query succeeds and returns expected results
9
Environment
- Client version: 0.8.6
- Language version: Clojure 1.12.0
- OS: Sequoia 15.3.1
ClickHouse Server
- ClickHouse Server version: 25.2.2.39