The current implementation of com.clickhouse.jdbc.ClickHouseDatabaseMetaData.getPrimaryKeys() in com.clickhouse:clickhouse-jdbc:0.6.0-patch4 just returns an empty ResultSet, though I think it would be relatively simple to implement this correctly.
For my own purposes, I run a query like this one:
select
system.tables.database,
system.tables.name,
(('KEY_' || system.tables.name) || '_PRIMARY') constraint_name,
trim(c.1) column_name,
c.2 column_index
from system.tables
array join arrayZip(splitByChar(',', primary_key), arrayEnumerate(splitByChar(',', primary_key))) as c
where (
system.tables.primary_key <> ''
and system.tables.database in ('default')
)
It generates a synthetic constraint name, because apparently the original name isn't stored in the catalog. Feel free to re-use this in some way in the driver.
The current implementation of
com.clickhouse.jdbc.ClickHouseDatabaseMetaData.getPrimaryKeys()
incom.clickhouse:clickhouse-jdbc:0.6.0-patch4
just returns an emptyResultSet
, though I think it would be relatively simple to implement this correctly.For my own purposes, I run a query like this one:
It generates a synthetic constraint name, because apparently the original name isn't stored in the catalog. Feel free to re-use this in some way in the driver.