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
Structured queries (POST /v1/query) accept any identifier ClickHouse accepts — except one whose name contains a literal ?. Such identifiers are rejected fail-closed by bindUnsafe() in internal/query/builder.go. This issue tracks why, and what it would take to lift the restriction.
Root cause — clickhouse-go positional binder is not quoting-aware
We bind filter / time-range values as positional ? parameters (the driver escapes them safely). The driver's ?-binding scans the query string and counts every? to match against the supplied args — it is not quoting-aware, so it also counts ? characters inside string literals and inside backtick-quoted identifiers.
Because the builder backtick-quotes identifiers, a column named a?b becomes `a?b` in the SQL — which still contains a ?. The driver then miscounts that ? against our value args.
SELECT '?' AS lit, ? AS bound + 1 arg → ERROR: have no arg for param ? at last 1 positions
SELECT `?` FROM t WHERE `?` = ? + 1 arg → ERROR: have no arg for param ? at last 2 positions
The driver counted the ? inside the '?' literal and inside the `?` identifiers as parameter placeholders. Best case it errors; worst case an off-by-one shifts a value into the wrong slot — including, in principle, a row-level-security filter value — which is why we fail closed rather than emit the query.
Corroborating (same class, different driver)
metabase/metabase#56364 — a column named field? with a WHERE filter fails as Unknown … identifier 'fieldnull' (the ? in the identifier is consumed by positional binding). Same root behavior in a different ClickHouse driver.
Current mitigation
internal/query/builder.gobindUnsafe() rejects any identifier (column, table, alias, group_by/order_by/time_range) containing ? with a clear 4xx before the query is built. Pathological — no real schema names a column ? — and it fails closed (never mis-binds).
Path to removal
Server-side {name:Identifier} params would avoid ? entirely (the identifier becomes param data, never query text). Blocked today: clickhouse-go cannot mix {name:…} params with positional ? value binding (unsupported query parameter type), so adopting it means converting all values to typed named params — a larger change to the value path, deferred.
Upstream fix: a quoting-aware positional binder in clickhouse-go removes the need for the restriction. No existing clickhouse-go issue found tracking this — worth filing upstream. Relevant code: clickhouse-go/bind.go.
Acceptance
Either adopt server-side {name:Identifier} params for identifiers, or land an upstream quote-aware binder; then drop the ? rejection in bindUnsafe() and add a real-ClickHouse round-trip test for a ?-named column.
Activity
feat(query): accept any ClickHouse identifier; add select_all projection
feat(docs): earned breakout, fit-first zoom, format tabs, SDK runtimes