The backslash branch in Format.cpp formatted the INSERT AST (which has
its format field cleared) but omitted the `insert_query_payload` data.
The non-backslash branch correctly appended the payload, but this was
not replicated in the backslash branch.
Also fix multiquery semicolon handling in the backslash branch for
INSERT VALUES queries — when the payload is present, the semicolon is
already included in the data, so we must not add another one.
Closes https://github.com/ClickHouse/ClickHouse/issues/103533
Co-Authored-By: Claude Opus 4.6 <[email protected]>
* Make client rainbow parentheses optional
* Make client rainbow parentheses optional
* Make client rainbow parentheses optional
* Make client rainbow parentheses optional
* Fix style and clang-tidy CI failures
- In `programs/format/Format.cpp`, replace `options.count(...)` with
`options.contains(...)` to satisfy the `readability-container-contains`
clang-tidy check that fires in the `arm_tidy` build.
- In `src/Client/ClientBaseHelpers.cpp`, drop redundant braces around
single-statement `if (!rainbow_parentheses) ...` blocks. One of them
had the opening brace on the same line, which the C++ style check
rejects (Allman braces are required).
CI report: https://github.com/ClickHouse/ClickHouse/pull/103851
---------
Co-authored-by: Alexey Milovidov <[email protected]>
Dictionary layout types (`complex_key_hashed`, `range_hashed`,
`ssd_cache`, etc.), source types, and source/layout parameter names
(`PORT`, `PASSWORD`, `DB`, `SIZE_IN_CELLS`, `BLOCK_SIZE`, `SHARDS`,
etc.) were being obfuscated, producing invalid SQL output.
Add `getAllRegisteredNames` to `DictionaryFactory` and
`DictionarySourceFactory`, register their names as known identifiers,
add dictionary parameter keywords to the obfuscator keyword list,
and remove the now-redundant hardcoded dictionary layout/source
keywords that are covered by the factory-based approach.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Add `DatabaseFactory::getAllRegisteredNames` to the known identifiers
set so database engine names like `Atomic`, `Memory`,
`MaterializedPostgreSQL`, etc. are not obfuscated.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Skip index type names (`minmax`, `set`, `bloom_filter`, `ngrambf_v1`,
`tokenbf_v1`, etc.) and compression codec names (`LZ4`, `ZSTD`, `Delta`,
etc.) were being obfuscated, producing invalid SQL output.
Add `getAllRegisteredNames` to `MergeTreeIndexFactory` and
`CompressionCodecFactory`, and register their names as known identifiers
in the obfuscator.
Closes#99248
Co-Authored-By: Claude Opus 4.6 <[email protected]>
The query obfuscator (`clickhouse format --obfuscate`) was producing
unparseable SQL for many queries. This fixes several categories of issues:
1. Add missing keywords for SYSTEM commands (`FLUSH`, `LOGS`, `DNS`,
`CACHE`, `RELOAD`, etc.), dictionary definitions (`FLAT`, `HASHED`,
`CLICKHOUSE`, etc.), special SQL constructs (`EXTRACT`, `TRIM`,
`DECIMAL`), multi-word data types (`NATIONAL`, `NCHAR`, `BINARY`,
`LARGE`, `OBJECT`), and substitution syntax (`Identifier`).
2. Fix hex/binary number prefix corruption: `0x1234` was becoming
`0p1234` because the `x` was treated as alphabetical and obfuscated.
Now preserves `0x`/`0b` prefixes and handles hex float literals
like `0xD.5p-6`.
3. Fix hex/binary string literal content corruption: `x'ABCD'` was
producing invalid hex like `x'WXYZ'`. Now replaces hex digits with
random hex digits and binary digits with random binary digits.
4. Make known identifier lookup case-insensitive: `DECIMAL` and
`decimal` are now recognized as known types like `Decimal`.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
This commit improves the help output for all ClickHouse applications:
- Add `clickhouse help` command that lists all available subcommands
- Return exit code 0 for all help messages (previously some returned 1)
- Output help messages to stdout instead of stderr
- Use "clickhouse <cmd>" format instead of argv[0] in help messages
- Add dynamic `app_name` detection for `clickhouse client` and `clickhouse local`
to show correct invocation name based on how the binary was called
- Add `--no-sudo` option for `clickhouse start` and `clickhouse restart`
for environments without sudo (e.g., Docker containers)
- Add detailed help headers and footers for client and local with usage examples
Closes#58244
Co-Authored-By: Claude Opus 4.5 <[email protected]>
The setting was introduced and set false by default in 24.2. It was enabled by default in 25.2. As there are no LTS versions that doesn't support the new format, we can remove the setting.
- clang-tidy rightfully complains (-readability-static-accessed-through-instance)
- not going to enable the warning for now to avoid breaking the build