Skip to content

Cherry pick #122870 to 26.3: Hide a Backup locator named like a COLUMNS matcher in EXPLAIN AST instead of throwing - #123035

Merged
robot-clickhouse-ci-2 merged 55 commits into
backport/26.3/122870from
cherrypick/26.3/122870
Oct 3, 2026
Merged

robot-clickhouse-ci-2 merged 55 commits into
backport/26.3/122870from
cherrypick/26.3/122870

Conversation

@robot-ch-test-poll3

Copy link
Copy Markdown
Contributor

Original pull-request #122870

Do not merge this PR manually

This pull-request is a first step of an automated backporting.
It contains changes similar to calling git cherry-pick locally.
If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.

The check results does not matter at this step - you can safely ignore them.

Before you resolve anything

Conflicts are often caused by a prerequisite change that has not been backported yet, rather than by a real divergence. The bot re-tries this cherry-pick against the release branch on every run, so if that is the case here it will merge itself as soon as the prerequisite lands, and you will see a comment saying so. Manual resolution is only needed while the conflict persists.

Troubleshooting

If the conflicts were resolved in a wrong way

If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:

  • delete the pr-cherrypick label from the PR
  • delete this branch from the repository

You also need to check the Original pull-request for pr-backports-created label, and delete if it's presented there

The PR source

The PR is created in the CI job

groeneai and others added 3 commits September 29, 2026 11:16
…T` instead of throwing

With secrets hidden, `EXPLAIN AST` replaces a secret argument with the
masked SQL the secret finder produces for the formatter, parsed back, and
sets the argument's alias on the result. The `Backup` database rule wrote
the locator function name unquoted, so `` `t.COLUMNS`('x') `` was masked as
`t.COLUMNS('[HIDDEN]')`, which parses back as a qualified `COLUMNS`
matcher. A matcher cannot carry an alias, so `EXPLAIN AST` threw
`Can't set alias ... (LOGICAL_ERROR)`.

Print the locator name with `backQuoteIfNeed`, as `ASTFunction` prints a
function name, so the masked text reads back as the same function and
keeps its structure in the dump. In `replaceWithMaskedText`, hide the
argument whole when the parsed text cannot carry an alias, as it already
did for text that does not parse: a bare `COLUMNS` name stays unquoted in
both the formatter and the finder, and the reconstructed `S3(...)` locator
writes a named-collection identifier as written, so its text can also end
in a matcher.

Closes #122810

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…olumns-name

Hide a `Backup` locator named like a `COLUMNS` matcher in `EXPLAIN AST` instead of throwing
@robot-ch-test-poll3 robot-ch-test-poll3 added pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! do not test disable testing on pull request labels Sep 30, 2026
robot-clickhouse and others added 23 commits September 30, 2026 10:56
`ComparisonGraph::normalizeAtom` (the AST overload) flips `less`/`lessOrEquals`
into `greater`/`greaterOrEquals` by swapping the two arguments, but it accessed
`children[0]` and `children[1]` without checking the argument count. The AST
reaching `ConstraintsDescription::buildGraph` is not analyzed, so a constraint
expression such as `CHECK less(a)` (a unary `less`) caused an out-of-bounds read:
`Assertion 'this->m_holder.m_size > n' failed` in debug builds and a segfault in
release builds. The query-tree overload is protected by function resolution and
its own `chassert(arguments.size() == 2)`; the AST path had no such guard.

Only binary comparisons can be normalized, so anything else is left unchanged and
ignored later, where `arguments.size() == 2` is already checked.

Found by the AST fuzzer on the new `ALTER ... MODIFY CONSTRAINT` test:
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=108768&sha=686df51dd6d5f41a3043194c6418c5059a53c793&name_0=PR&name_1=AST%20fuzzer%20%28amd_debug%2C%20targeted%29
#108768

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
(cherry picked from commit 01e999e)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The cherry-picked test exercised `ALTER TABLE ... MODIFY CONSTRAINT`, which was introduced together with the fix in #108768 and does not exist on this branch. Replace that case with a `CREATE TABLE` reproducer (`CHECK less(a)`), and cover `ASSUME less(a)` and a zero-argument `less()` as well.

Also rename it to `04489_constraint_comparison_wrong_arity`, the name it has on master.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Backport #119244 to 26.3: Do not log kafka secrets
…erialized-view targets of partitioned tables
…raph-wrong-arity

Backport fix for a malformed comparison in a constraint to 26.3
Backport #122681 to 26.3: Build Iceberg min/max hyperrectangles only for columns the filter uses
Backport #112649 to 26.3: Fix deduplication token attribution for materialized-view targets of partitioned tables
Backport #122057 to 26.3: Mask credentials of an S3 URI in validation exceptions
Backport #123060 to 26.3: Hide queue engine secrets written with the legacy `s3queue_` prefix
Backport #117403 to 26.3: Fix ssl_certificate authentication bypass via embedded NUL byte in certificate CN
Backport #121398 to 26.3: Skip the direct join when the right table has a row policy
Backport #122673 to 26.3: Hide HTTP headers of `HTTP` dictionary sources
robot-clickhouse and others added 18 commits October 2, 2026 09:14
…budget for the aggregate state read

On 26.3 `input_format_binary_max_type_complexity` is read from the query context for every binary
type decoding, including an `AggregateFunction` state, while master leaves stored data unlimited.
So the `finalizeAggregation` query hit the default budget (`INCORRECT_DATA`) before the stack guard
the test expects. Disable the budget for it, like the `format` query before it.

#123470

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Backport #123336 to 26.3: Do not dereference a null `logs_queue` in `OwnSplitChannel::log`
Backport #120313 to 26.3: Hide secret arguments in `EXPLAIN AST` output
Backport #117730 to 26.3: Memory-track the JSON `FLATTENED` path list read from `Native`
Backport #117765 to 26.3: Fix out-of-bounds reads when reading malformed JSON and Dynamic columns
Backport #122574 to 26.3: Use less schema comparison
Backport #122829 to 26.3: Fix crash on invalid Iceberg manifest-list entries
…privilege of the replaced table via `Replicated` databases and `ON CLUSTER`
Backport #121825 to 26.3: Use the remote host filter in Kafka and NATS engines
@groeneai

groeneai commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator

Resolved, on my fork

backport/26.3/122870 was cut before #120313 reached 26.3 (#123453), so the automatic retry still conflicts, once: in the include block of src/Interpreters/InterpreterExplainQuery.cpp. On master the new Parsers/ASTWithAlias.h include sits next to ASTSubquery.h and ASTTablesInSelectQuery.h, which 26.3 does not include. I kept the 26.3 block and added only ASTWithAlias.h.

I do not have push access here, so the merge is on my fork. Both refs move by fast-forward:

git fetch https://github.com/groeneai/ClickHouse groeneai/resolve-26.3-cherrypick-122870
git push --atomic origin FETCH_HEAD^2:refs/heads/backport/26.3/122870 FETCH_HEAD:refs/heads/cherrypick/26.3/122870

FETCH_HEAD is 852e7d78a9ad, tree 51467736e336: git merge --no-ff of the base into this PR's head 1952ec9a7d2f. Its second parent 7db572f88dd0 is git merge 26.3 (at 5242cd0bdcc5) on the current base 831211e30253, and has exactly the 26.3 tree. git diff --name-only FETCH_HEAD^2 FETCH_HEAD is the 4 paths #122870 touched, each with the same added and removed lines as on master. The second refspec alone also works; the first one only keeps this PR's file list to those 4 paths.

Checked on a 26.3 debug build of this commit (clang-21): 05295_explain_ast_backup_locator_columns_name and 05219_explain_ast_hide_secrets pass 50/50 with randomized settings, and the other 20 secret-masking tests that run without S3 pass. Without the two src/ hunks, 05295 aborts the server with Logical error: 'Can't set alias of t.COLUMNS('[HIDDEN]') of QualifiedColumnsRegexpMatcher'.

PedroTadim and others added 8 commits October 2, 2026 17:43
Backport #120516 to 26.3: Fix access checks in PREWHERE and indexHint() that used aliases
Backport #122667 to 26.3: Fix server crash on a deeply nested Field in a binary encoded type
Backport #123114 to 26.3: S3 client check initial url in backup client
Backport #122211 to 26.3: Undo a filesystem cache reservation when the key directory cannot be created
Backport #109364 to 26.3: Retry transient MinIO InvalidPart on S3 CompleteMultipartUpload
Backport #122272 to 26.3: Fix `CREATE OR REPLACE` bypassing the drop privilege of the replaced table via `Replicated` databases and `ON CLUSTER`
The prerequisite #120313 (`EXPLAIN AST` secret hiding) reached 26.3 through
#123453 after this cherry-pick was created, so merge 26.3 first. The only
remaining conflict is the include list: keep 26.3's includes and add
`Parsers/ASTWithAlias.h`, which the fix needs. `ASTSubquery.h` and
`ASTTablesInSelectQuery.h` are master-only context and are not needed here.

Backport of #122870

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@robot-clickhouse-ci-2
robot-clickhouse-ci-2 merged commit 6f4bb9e into backport/26.3/122870 Oct 3, 2026
1 check passed
@robot-clickhouse-ci-2
robot-clickhouse-ci-2 deleted the cherrypick/26.3/122870 branch October 3, 2026 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not test disable testing on pull request pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only!

Projects

None yet

Development

Successfully merging this pull request may close these issues.