You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Passing a List<String> as a query parameter in client-v2 requires to single quote every element #2407
The API for query parameters could be more user-friendly for List<String>, and not require to manually surround every string element with a single quote.
Steps to reproduce
See test below.
Error Log or Exception StackTrace
Code: 26. DB::Exception: Cannot parse quoted string: expected opening quote ''', got 'C': value [COLLATIONS, ENGINES] cannot be parsed as Array(String) for query parameter 'table_names'. (CANNOT_PARSE_QUOTED_STRING) (version 25.3.3.42 (official build))
Expected Behaviour
Code Example
@TestvoidtestParamsWithStringList() throwsException {
finalClientclient = newClient.Builder()
.addEndpoint(Protocol.HTTP, "localhost", 8123, false)
.setUsername("default")
.setPassword("")
.build();
finalMap<String, Object> params = Map.of("table_names", List.of("COLLATIONS", "ENGINES"));
// This query should not throw an exceptionclient.query("SELECT database, name FROM system.tables WHERE name in {table_names:Array(String)}", params).get();
}
Test is passing when using Map.of("table_names", List.of("'COLLATIONS'", "'ENGINES'")) as params.
changed the title [-]Passing a `List<String>` as a query parameter requires to sinle quote every element[/-][+]Passing a `List<String>` as a query parameter in client-v2 requires to single quote every element[/+]on Jun 3, 2025
Verified against current main (f862dfd): this is already fixed by #2898 (merged 2026-07-08), so passing a List<String> for an Array(String) parameter no longer needs manual per-element quoting. The fix is unreleased as of 0.8.6 / 0.9.8 — it lands in 0.10.0-rc1.
What changed
#2898 added a container-aware parameter formatter (DataTypeConverter#convertParameterToString) that Client.query(...) now applies to every parameter value before it is sent. A Collection / array / Map bound to an Array / Map placeholder is rendered as ClickHouse array/map text with String/temporal leaves single-quoted and numeric/boolean leaves left unquoted — exactly what the server's param_<name> parser expects. So List.of("COLLATIONS", "ENGINES") is now sent as ['COLLATIONS','ENGINES'] instead of [COLLATIONS, ENGINES]. (Your two-arg client.query(sql, params) call routes through the same formatter.)
Verification on current main
Your exact reproduction, run against a live server, comparing the two param_table_names encodings for:
SELECT database, name FROM system.tables WHERE name IN {table_names:Array(String)}
before (old client output) param_table_names=[COLLATIONS, ENGINES] → Code: 26. DB::Exception: Cannot parse quoted string: expected opening quote ''', got 'C' ... (CANNOT_PARSE_QUOTED_STRING) — the exact error you reported
after (current-main client output) param_table_names=['COLLATIONS','ENGINES'] → returns the expected rows
Regression tests covering List<String> → Array(String) are already merged and green on main:
unit — DataTypeConverterTest#testConvertParameterToString asserts List.of("a","b") → ['a','b']
integration — QueryTests#testContainerQueryParamsQuoteInnerValues round-trips Array(String) end-to-end through client.queryAll
Recommendation
No further code change is needed. @chernser — this can be closed as fixed by #2898.
Activity
[-]Passing a `List<String>` as a query parameter requires to sinle quote every element[/-][+]Passing a `List<String>` as a query parameter in client-v2 requires to single quote every element[/+]chernser commentedon Jun 5, 2025
@jnd77 thank you for reporting!
We will look into it.
usatenko commentedon Feb 20, 2026
is there any update?
chernser commentedon Feb 20, 2026
Good day, @usatenko!
Currently no. We will see if can schedule on a release in March.
juliomejia97 commentedon Apr 7, 2026
Is there any update?
chernser commentedon Apr 7, 2026
@juliomejia97
Good day, we will try in the next release I think. It should be in the May.
polyglotAI-bot commentedon Jul 9, 2026
Verified against current
main(f862dfd): this is already fixed by #2898 (merged 2026-07-08), so passing aList<String>for anArray(String)parameter no longer needs manual per-element quoting. The fix is unreleased as of 0.8.6 / 0.9.8 — it lands in0.10.0-rc1.What changed
#2898 added a container-aware parameter formatter (
DataTypeConverter#convertParameterToString) thatClient.query(...)now applies to every parameter value before it is sent. ACollection/ array /Mapbound to anArray/Mapplaceholder is rendered as ClickHouse array/map text with String/temporal leaves single-quoted and numeric/boolean leaves left unquoted — exactly what the server'sparam_<name>parser expects. SoList.of("COLLATIONS", "ENGINES")is now sent as['COLLATIONS','ENGINES']instead of[COLLATIONS, ENGINES]. (Your two-argclient.query(sql, params)call routes through the same formatter.)Verification on current
mainYour exact reproduction, run against a live server, comparing the two
param_table_namesencodings for:param_table_names=[COLLATIONS, ENGINES]→Code: 26. DB::Exception: Cannot parse quoted string: expected opening quote ''', got 'C' ... (CANNOT_PARSE_QUOTED_STRING)— the exact error you reportedmainclient output)param_table_names=['COLLATIONS','ENGINES']→ returns the expected rowsRegression tests covering
List<String>→Array(String)are already merged and green onmain:DataTypeConverterTest#testConvertParameterToStringassertsList.of("a","b")→['a','b']QueryTests#testContainerQueryParamsQuoteInnerValuesround-tripsArray(String)end-to-end throughclient.queryAllRecommendation
No further code change is needed. @chernser — this can be closed as fixed by #2898.