Repository navigation
Description
What happened?
Connecting to a ClickHouse server that reports 23.8.8.20 looks like it works, and then everything the
app runs against that connection fails:
Code: 115. DB::Exception: Setting http_write_exception_in_output_format is neither a builtin setting
nor started with the prefix 'SQL_' registered for user-defined settings. (UNKNOWN_SETTING)
(version 23.8.8.20 (official build))
The server, the network and the credentials are not at fault — the same host/port/user answers the
driver's first two queries. ClickHouseResponseClassifier.transportQueryItems adds
http_write_exception_in_output_format=0 to every query, gated by
ClickHouseCapabilities.hasWriteExceptionInOutputFormatSetting:
var hasWriteExceptionInOutputFormatSetting: Bool {
major > 23 || (major == 23 && minor >= 8)
}23.8.8.20 parses to major 23, minor 8, the gate opens, and the server rejects the whole request.
The setting was added by ClickHouse#52853 (merged 2023-09-26, first released in 23.9) and backported
into the 23.8 LTS line by ClickHouse#57668 (merged 2023-12-08), so 23.8.0–23.8.8 never had it.
src/Server/HTTPHandler.cpp at the release tags:
| Tag | Published | Setting present |
|---|---|---|
v23.8.8.20-lts |
2023-11-25 | no |
v23.8.9.54-lts |
2024-01-05 | yes |
v23.8.16.40-lts |
2024-08-02 | yes |
v23.9.1.1854-stable |
2023-09-29 | yes |
This reads as "cannot connect" rather than "queries fail" because serverVersion is only known once |
||
SELECT version() has returned: the two handshake queries (SELECT 1, SELECT version()) go out |
||
| without the parameter and succeed, and every query after them carries it and is rejected — so the | ||
| database and schema list loaded right after connect is what actually breaks. |
Steps to reproduce
docker run --rm -d -p 8123:8123 clickhouse/clickhouse-server:23.8.8.20- Add a ClickHouse connection to
localhost:8123, userdefault, no password. - Connect, then run
SELECT 1.
The same error comes back. Server side, the two requests differ only in the parameter:
curl -s 'http://localhost:8123/?default_format=TabSeparatedWithNamesAndTypes&wait_end_of_query=1&http_write_exception_in_output_format=0&query=SELECT%201'
# Code: 115 … UNKNOWN_SETTING (version 23.8.8.20 (official build))
curl -s 'http://localhost:8123/?default_format=TabSeparatedWithNamesAndTypes&wait_end_of_query=1&query=SELECT%201'
# 1 / UInt8 / 1Expected behavior
The connection opens and queries run against any server the handshake succeeds on. A server that does
not know the setting should not be sent it: the driver already implements that path
(transportQueryItems(supportsWriteExceptionSetting: false)), and omitting the parameter only means
errors arrive as plain text instead of the format-wrapped body — which is exactly what a 23.8.8 server
produces natively, and what ClickHouseResponseClassifier already handles for older servers.
Suggested fix
- major > 23 || (major == 23 && minor >= 8)
+ major > 23 || (major == 23 && minor >= 9)with the test that encodes the current assumption updated ("The write-exception setting needs ClickHouse 23.8 or later" → 23.9, 23.8 unsupported). Treating every 23.8 build as unsupported costs
nothing, since the setting only asks for a friendlier error body. Parsing the patch level instead
(23.8.9+) would work too, but major.minor is all ClickHouseCapabilities keeps today. Happy to send
this as a PR with the test change if that is easier.
Database type
ClickHouse
TablePro version
0.81.0
Platform
macOS
OS version & hardware
macOs 26.6.2 / Apple Silicon
Screenshots / Logs
No response
Activity