Skip to content

getImportedKeys returns empty row in 0.9.1 #2517

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

Activity

  1. added
    jdbc-v2jdbc-v2 issues
    area:jdbc-metadataissue handling metadata things like getting type of column
    on Jul 31, 2025
  2. mshustov commented on Jul 31, 2025

    @mshustov
    Member

    @chernser can we have at least a dummy implementation of DatabaseMetadata as in the old version

    return empty("PKTABLE_CAT Nullable(String), PKTABLE_SCHEM Nullable(String), PKTABLE_NAME String, "
    ?

  3. chernser commented on Jul 31, 2025

    @chernser
    Contributor

    @mshustov yes, I think.

  4. added this to the 0.9.2 milestone on Jul 31, 2025
  5. chernser commented on Aug 12, 2025

    @chernser
    Contributor

    @mshustov
    yes, sure.
    I think may be even correct one.

  6. self-assigned this
    on Aug 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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