Skip to content

getImportedKeys returns empty row in 0.9.1 #2517

@dpsutton

Description

@dpsutton

jdbc-v2

Description

Steps to reproduce

In 0.8.4:

clj -Sdeps '{:deps {com.clickhouse/clickhouse-jdbc {:mvn/version "0.8.4"}}}'
user=> (import '(java.sql DriverManager Statement))
java.sql.Statement
user=> (with-open [conn (DriverManager/getConnection "jdbc:clickhouse://localhost:8123" "default" "password")
                   rs (.getImportedKeys (.getMetaData conn) nil "test_data" "orders")]
         (let [rs-meta (.getMetaData rs)
               col-count (.getColumnCount rs-meta)]
           (while (.next rs)
             (let [row-map (reduce
                             (fn [acc i]
                               (assoc acc (.getColumnLabel rs-meta i) (.getObject rs i)))
                             {}
                             (range 1 (inc col-count)))]
               (println row-map)))))
nil

Contract on 0.9.1:

clj -Sdeps '{:deps {com.clickhouse/clickhouse-jdbc {:mvn/version "0.9.1"}}}'

Error Log or Exception StackTrace

user=> (import '(java.sql DriverManager Statement))
java.sql.Statement
user=> (with-open [conn (DriverManager/getConnection "jdbc:clickhouse://localhost:8123" "default" "password")
                   rs (.getImportedKeys (.getMetaData conn) nil "test_data" "orders")]
         (let [rs-meta (.getMetaData rs)
               col-count (.getColumnCount rs-meta)]
           (while (.next rs)
             (let [row-map (reduce
                             (fn [acc i]
                               (assoc acc (.getColumnLabel rs-meta i) (.getObject rs i)))
                             {}
                             (range 1 (inc col-count)))]
               (println row-map)))))
{FKCOLUMN_NAME nil, PKTABLE_CAT nil, FKTABLE_NAME nil, PKTABLE_SCHEM nil, FKTABLE_CAT nil, KEY_SEQ nil, PK_NAME nil, FKTABLE_SCHEM nil, PKCOLUMN_NAME nil, FK_NAME nil, DEFERRABILITY nil, UPDATE_RULE nil, PKTABLE_NAME nil, DELETE_RULE nil}
nil

Expected Behaviour

surprised to see this behavior change

Metadata

Metadata

Assignees

Labels

area:jdbc-metadataissue handling metadata things like getting type of columnbugjdbc-v2jdbc-v2 issues

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions