Skip to content

Backport #103843 to 26.4: Preserve known identifiers in obfuscateQuery - #104208

Merged
alexey-milovidov merged 1 commit into
26.4from
backport/26.4/103843
May 6, 2026
Merged

alexey-milovidov merged 1 commit into
26.4from
backport/26.4/103843

Conversation

@robot-ch-test-poll1

@robot-ch-test-poll1 robot-ch-test-poll1 commented May 6, 2026 •

Copy link
Copy Markdown
Contributor

Original pull-request #103843
Cherry-pick pull-request #103974

This pull-request is a last step of an automated backporting.
Treat it as a standard pull-request: look at the checks and resolve conflicts.
Merge it only if you intend to backport changes to the target branch, otherwise just close it.

The PR source

The PR is created in the CI job

Version info

  • Merged into: 26.4.2.9

@robot-ch-test-poll1 robot-ch-test-poll1 added the pr-backport Changes, backported to release branch. Do not use manually - automated use only! label May 6, 2026
@clickhouse-gh

clickhouse-gh Bot commented May 6, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [BackportPR], commit [f1ebdf6]

@alexey-milovidov
alexey-milovidov marked this pull request as draft May 6, 2026 11:27
@alexey-milovidov
alexey-milovidov marked this pull request as draft May 6, 2026 11:27
The SQL function `obfuscateQuery` (and `obfuscateQueryWithSeed`) used to
pass an empty `known_identifier_func` to `obfuscateQueries`, so names of
built-in functions, aggregate functions, table functions, formats, data
types, storages, codecs and settings were replaced by random words —
making the output less readable and inconsistent with
`clickhouse-format --obfuscate`.

Mirror the logic from `programs/format/Format.cpp` so all registered
names are kept as-is. The set is built lazily once per process.

Also fix `TableFunctionFactory::isTableFunctionName` to consult aliases
and the case-insensitive map (mirroring `tryGet`), so table functions
written in uppercase (e.g. `VALUES`) or via aliases are recognized as
known identifiers by both `obfuscateQuery` and `clickhouse-format
--obfuscate`.

Adds a regression test in
`tests/queries/0_stateless/04146_obfuscate_query_known_identifiers.sql`.

Original pull-request: #103843

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@alexey-milovidov
alexey-milovidov marked this pull request as ready for review May 6, 2026 15:24
@alexey-milovidov
alexey-milovidov merged commit 30a19e7 into 26.4 May 6, 2026
30 of 33 checks passed
@alexey-milovidov
alexey-milovidov deleted the backport/26.4/103843 branch May 6, 2026 16:59
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…3843

Backport ClickHouse#103843 to 26.4: Preserve known identifiers in `obfuscateQuery`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backport Changes, backported to release branch. Do not use manually - automated use only!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants