Set prefer_column_name_to_alias on ClickHouse connections (#948)

ClickHouse resolves identifiers to select-list aliases before table
columns by default, so lookup queries that reuse a column name as an
alias (e.g. 'data as metadata, 0 as data' in the item lookup) return
the alias literal instead of the column. Item lookups then return
metadata as UInt8 0, mixed lookup unions produce
Variant(Array(Int8), UInt8), and the JDBC client fails every /co
lookup with 'Column is not of array type'.

Setting prefer_column_name_to_alias=1 restores the alias semantics
these queries rely on under SQLite and MySQL.

Fixes #947
This commit is contained in:
Ben authored and GitHub committed 2026-08-18 13:46:57 -06:00
1 parent 29f25cf1de
commit e3be1520fa
1 file changed
+1
@@ -46,6 +46,7 @@ public final class ClickHouseJdbcConfig {
properties.setProperty(SERVER_SETTING_PREFIX + "async_insert", "0");
properties.setProperty(SERVER_SETTING_PREFIX + "do_not_merge_across_partitions_select_final", "1");
properties.setProperty(SERVER_SETTING_PREFIX + "wait_end_of_query", "1");
properties.setProperty(SERVER_SETTING_PREFIX + "prefer_column_name_to_alias", "1");
properties.setProperty("ssl", Boolean.toString(tls));
properties.setProperty("jdbc_ignore_unsupported_values", "false");
}