Skip to content

Keep the column default when another MODIFY COLUMN restates the type - #114807

Merged
alexey-milovidov merged 4 commits into
ClickHouse:masterfrom
groeneai:fix-alter-two-modify-column-default
Sep 5, 2026
Merged

alexey-milovidov merged 4 commits into
ClickHouse:masterfrom
groeneai:fix-alter-two-modify-column-default

Conversation

@groeneai

@groeneai groeneai commented Aug 14, 2026 •

Copy link
Copy Markdown
Collaborator

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Fixed a single ALTER with two MODIFY COLUMN subcommands on the same column silently corrupting that column's default: a default set by one subcommand was dropped, and a REMOVE DEFAULT/MATERIALIZED/ALIAS was undone, whenever a following subcommand restated the column type.

Description

Two MODIFY COLUMN subcommands on one column silently corrupted its default in two opposite directions, from plain DDL, returning success and logging nothing.

Wrong results:

CREATE TABLE t (event String, c UInt32) ENGINE = MergeTree() ORDER BY tuple();
ALTER TABLE t MODIFY COLUMN c UInt32 MATERIALIZED JSONExtractUInt(event, 'x'),
              MODIFY COLUMN c UInt32 CODEC(T64, LZ4);
INSERT INTO t (event) VALUES ('{"x":42}');
SELECT c FROM t;   -- 0, expected 42; default_kind was empty

Valid input rejected: MODIFY COLUMN c REMOVE MATERIALIZED, MODIFY COLUMN c UInt32 CODEC(...) left the MATERIALIZED in place, so a later INSERT INTO t (event, c) failed with ILLEGAL_COLUMN where it succeeds after a plain REMOVE.

AlterCommand::apply replaced the column default whenever the subcommand carried a data type, writing an empty default over what a preceding subcommand had written into the shared metadata copy. AlterCommands::prepare compensated by back-filling from the table, but it reads the pre-ALTER column: nothing to back-fill for a default just set, and a stale default to resurrect for one just removed.

Related: #113853 (comment)

The default is now replaced only when the subcommand carries a default expression, and the back-fill is gone, making MODIFY_COLUMN match ADD_COLUMN.

One accepted statement starts being rejected: dropping a MATERIALIZED that made the column nullable while restating the type as non-nullable now reports the conversion it cannot perform, as those statements issued separately already do.

New test 04904 fails on the parent commit and passes with the fix; 50/50 randomized runs and a 55-test ALTER neighbour set are green.

Also noticed, not addressed here: validate() checks removals and type compatibility against the pre-ALTER default, so an existing default unreadable as the new type is rejected with a single MODIFY COLUMN, and a REMOVE DEFAULT beside a subcommand that sets one is rejected.


Workflow [PR]
Sync PR [sync-upstream/pr/114807]

A single ALTER with two MODIFY COLUMN subcommands on the same column silently
corrupted that column's default, in two opposite directions, and both are
reachable from plain DDL on a default MergeTree:

    ALTER TABLE t MODIFY COLUMN c UInt32 MATERIALIZED JSONExtractUInt(event, 'x'),
                  MODIFY COLUMN c UInt32 CODEC(T64, LZ4);

dropped the MATERIALIZED expression, so the column read the type's zero value
instead of the computed one, and

    ALTER TABLE t MODIFY COLUMN c REMOVE MATERIALIZED,
                  MODIFY COLUMN c UInt32 CODEC(T64, LZ4);

restored the default the REMOVE had just deleted, so a later explicit INSERT was
rejected with ILLEGAL_COLUMN where it succeeds after a plain REMOVE. Both
returned success and logged nothing. Omitting the redundant type in the second
subcommand was already correct, so one token decided whether the statement
worked.

AlterCommand::apply replaced the column default whenever the subcommand carried
a data type, writing an empty default over what a preceding subcommand of the
same ALTER had written into the shared metadata copy. AlterCommands::prepare
compensated by back-filling the default from the table, but it reads the
pre-ALTER column, and that one fact produced both directions: nothing to
back-fill for a default just set, and a stale default to resurrect for one just
removed.

Replace the default only when the subcommand carries a default expression, which
is an exact test because both parser sites set default_kind only inside
`if (ast_col_decl.getDefaultExpression())`, and removals are handled by the
earlier to_remove branches. That makes the MODIFY_COLUMN path match the
ADD_COLUMN path, which already guards on default_expression alone, and lets
composition fall out of the sequencing apply() already performs, so the
compensating back-fill in prepare() is removed with it.

One currently accepted statement starts being rejected: dropping a MATERIALIZED
that made the column nullable and restating the type as non-nullable now reports
the conversion it cannot perform, which is what the same two statements issued
separately already do.
Both state the local invariant only. Net comment count over the change is
unchanged: each replaces a comment this change makes wrong.
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review (click to expand)

Reviewed independently before publishing: an author-blind read of the resulting code, then a
second-model pass over the same diff, then adjudication against the recorded evidence. One
round, no fix rounds needed.

# Finding Verdict
💡 AlterCommands::prepare's declaration comment still offers "absent default" as its example of a field filled from the table's metadata, which is exactly the back-fill this change deletes. Agreed and correct. Not changed here: AlterCommands.h is not otherwise touched by this PR, the sentence's claim still holds (prepare continues to derive data_type for ADD ENUM VALUES and to set ignore), and only the parenthetical example went stale. Noting it for whoever next edits that declaration.
💡 MergeTreeData::checkSpecialColumn reads command.default_kind after prepare runs, so deleting the back-fill changes what it observes for a version, sign, is_deleted or summing column. Checked, no impact. That guard rejects only Ephemeral and Alias, and every one of those special-column checks iterates getAllPhysical(), which excludes both kinds, so such a column can never hold one and the back-fill could never have supplied one. The guard's surviving rejection is pinned as a test case.
💡 Does a default that now survives a real type change reach persisted metadata without being validated against the new type? No. validate() still builds its default expression list from the pre-ALTER column whenever a subcommand carries a type and no default, so the conversion check still runs, and validateCreateQuery re-validates every default in the resulting CREATE query before the metadata file is written. Two of the test cases pin the resulting rejections.
💡 Test liveness, traced per case rather than assumed. Every case that asserts the fix flips when the change is reverted: six assert default_kind and default_expression directly, two assert an INSERT that fails ILLEGAL_COLUMN when the removal is undone, and two are the controls for deleting the back-fill (a real UInt32 to UInt64 change must keep its MATERIALIZED and convert stored data). On the parent commit the test fails by printing the wrong values, not by failing to set up.

No blocking or major finding. Notes on scope, stated plainly rather than buried:
ReplicatedMergeTree was not verified locally, since this slot has no Keeper; the changed code
is engine-independent, and CI's ZooKeeper and replicated jobs cover it. The local regression
sweep was 55 ALTER neighbours on both binaries with identical coverage per arm, which is
narrower than CI's full suite by design.

Session id: cron:clickhouse-review-self-slot-58:20260814-110600

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes, 100%, no randomization needed. clickhouse local --path=<fresh dir> -q "CREATE TABLE t (event String, c UInt32) ENGINE = MergeTree() ORDER BY tuple(); ALTER TABLE t MODIFY COLUMN c UInt32 MATERIALIZED JSONExtractUInt(event, 'x'), MODIFY COLUMN c UInt32 CODEC(T64, LZ4); INSERT INTO t (event) VALUES ('{\"x\":42}'); SELECT c FROM t" returns 0 on every run, expected 42.
b Root cause explained? Yes. AlterCommands::apply threads one running StorageInMemoryMetadata copy through the subcommands, so each sees its predecessors. AlterCommand::apply's MODIFY_COLUMN branch replaced column.default_desc under if (default_expression || data_type), so a subcommand that only restates the type entered it with default_expression == nullptr and default_kind at its enumerator zero, wiping the default a preceding subcommand had just written. AlterCommands::prepare compensated by back-filling from column_from_table, but that is the pre-ALTER column: nothing to back-fill for a default just set, and a stale default to resurrect for one just removed. One fact, two opposite symptoms.
c Fix matches root cause? Yes. It removes the writes at the defect site (if (default_expression)) and deletes the compensation that existed only for them, rather than guarding a symptom. Net src diff 7+/11-. The discriminator is exact, verified from source: both parser sites set default_kind only inside if (ast_col_decl.getDefaultExpression()), and removals never reach the site (it is the terminal else of the to_remove chain).
d Test intent preserved / new tests added? Yes. No existing test weakened, reduced or removed. New 04904_alter_two_modify_column_same_column_default with 12 numbered cases: 6 defect cases plus controls, including three pinned pre-existing errors that must stay unchanged.
e Both directions demonstrated? Yes. Same runner, same flags, same config, only the binary differs, each arm's Build ID asserted over HTTP immediately before the run. Pre-fix (9b8e7dfb...): FAIL on the defect, emitting 1 0 / 2 0 and an empty default_kind before dying Code: 44 ILLEGAL_COLUMN. Post-fix (24b74793...): OK. The pre-fix failure is the wrong values, not a setup error.
f Fix is general across code paths? Yes. All four ColumnDefaultKind carriers (DEFAULT, MATERIALIZED, ALIAS, EPHEMERAL) are fixed by the one change, because the wipe wrote the member initialiser and was never kind-specific; both directions (set and REMOVE) by the pair of edits. The sibling ADD_COLUMN branch already guarded on default_expression alone, so the two paths are now symmetric. comment, codec, ttl and settings were confirmed already guarded on being carried. Every consumer of command.default_kind outside this file was enumerated; the one that runs after prepare (MergeTreeData::checkSpecialColumn) was measured, not argued about.
g Fix generalizes across inputs? Yes. Nullable, LowCardinality, Array and Map wrappers measured byte-identical pre/post; 2- and 3-subcommand forms; type-restate vs real type change vs no type; EPHEMERAL with no expression probed separately; special columns of ReplacingMergeTree, CollapsingMergeTree and SummingMergeTree. A 55-test ALTER neighbour set ran on both binaries with identical coverage on each arm: no test fails only with the fix.
h Backward compatible? Yes. No new setting, no default change, no serialization or on-disk format change, so no SettingsChangesHistory.cpp entry is due. One intended new rejection, stated in the PR body, which converges on what the same two statements issued separately already do, with an error message that tells the user what to write.
i Invariants and contracts preserved? Yes. The narrowing strictly removes writes, so no path gains a mutation and apply() keeps its per-command contract with no new state. column_from_table stays in use for the enum merge, so nothing is orphaned. The columns.modify(...) type-snapshot advance immediately above the deleted block is untouched and verified live, chained ADD ENUM VALUES still composing. validate() is entirely untouched, so its default_expr_list accounting cannot newly fire, confirmed by the pinned MULTIPLE_EXPRESSIONS_FOR_ALIAS control being byte-identical. Mutation staging reads data_type, not the default, so a real type change still converts stored data.

Session id: cron:clickhouse-impl-self-slot-57:20260814-091600

@clickhouse-gh

clickhouse-gh Bot commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [b4bc975]

Summary: ✅


AI Review

Summary

This PR fixes the apply()-side bug where a later type-carrying MODIFY COLUMN subcommand wiped a default that an earlier subcommand on the same column had just set or removed. The new sequencing is directionally correct, but the validate() path still reasons about later same-column REMOVE DEFAULT / MATERIALIZED / ALIAS subcommands from the table's pre-ALTER metadata, so some sequentially valid MODIFY COLUMN combinations are still rejected.

Findings

⚠️ Majors

  • [src/Storages/AlterCommands.cpp:2160-2230] validate() still checks default removals against all_columns.getDefault(column_name) from the original metadata instead of the running post-previous-subcommand state. ALTER TABLE t MODIFY COLUMN c UInt32 DEFAULT 7, MODIFY COLUMN c REMOVE DEFAULT therefore still throws Column c doesn't have DEFAULT, even though the two statements succeed separately and the final metadata is unambiguous. Suggested fix: advance the per-column default state for later MODIFY COLUMN checks here, and add a focused regression case to 04904.
Final Verdict

⚠️ Needs changes before merge: the patch fixes one default-composition hole, but the validation path still rejects other sequentially valid same-column MODIFY COLUMN combinations.

LLVM Coverage Report

Measured on commit b4bc975.

Metric Baseline Current Δ
Lines 88.70% 88.70% +0.00%
Functions 92.10% 92.10% +0.00%
Branches 81.10% 81.10% +0.00%

Changed lines: Changed C/C++ lines covered: 9/9 (100.00%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Aug 14, 2026
@PedroTadim PedroTadim added the can be tested Allows running workflows for external contributors label Aug 14, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @alexey-milovidov @SmitaRKulkarni, could you review this? A MODIFY COLUMN subcommand that only restated the column type was overwriting column.default_desc with an empty default, so in a single ALTER it wiped the default a preceding subcommand had just set and undid a preceding REMOVE MATERIALIZED; the prepare() back-fill that compensated for it reads the pre-ALTER column, which is why it could not help in either direction.

CREATE TABLE t_mod_def (event String, c UInt32 MATERIALIZED JSONExtractUInt(event, 'x'))
ENGINE = MergeTree() ORDER BY tuple();
ALTER TABLE t_mod_def MODIFY COLUMN c UInt64 CODEC(T64, LZ4),
MODIFY COLUMN c UInt64 COMMENT 'z'; -- { serverError MULTIPLE_EXPRESSIONS_FOR_ALIAS }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AlterCommand::apply now composes these subcommands correctly, but AlterCommands::validate still does not: the else if (all_columns.has(column_name) && command.data_type) branch in src/Storages/AlterCommands.cpp:2197-2211 re-injects the pre-ALTER default once for every type-carrying MODIFY COLUMN that omits an explicit default. That means a column which already had a default still cannot compose

ALTER TABLE t
    MODIFY COLUMN c UInt64 CODEC(T64, LZ4),
    MODIFY COLUMN c UInt64 COMMENT 'z';

even though the two statements succeed separately and the final metadata is unambiguous. The same stale pre-ALTER default is also why case 11 still rejects REMOVE MATERIALIZED, MODIFY COLUMN c Int8. I think this needs a real fix in the validation path rather than a test that pins the broken behavior.

@groeneai groeneai Aug 14, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The residual is real, but it is pre-existing, and the case 11 half of it is reachable with a single subcommand, so neither half is composition and neither is this PR's defect.

Measured on the reviewed head and on its parent commit, same runner and flags, only the binary differs. Your example fails identically on both with Code: 179 MULTIPLE_EXPRESSIONS_FOR_ALIAS. Case 11 is that same rejection, and it needs neither a second subcommand nor REMOVE:

CREATE TABLE t (event String, c Enum8('x' = 1) MATERIALIZED 'x') ENGINE = MergeTree() ORDER BY tuple();
ALTER TABLE t MODIFY COLUMN c Int8;   -- Code: 6 CANNOT_PARSE_TEXT on both binaries

That single-subcommand form is pinned on line 168, right next to the combined one. The test records that combining the subcommands changes nothing, which is what makes it a control rather than a pin on broken composition.

Advancing the validation snapshot would break the shape this PR fixes. The branch, at src/Storages/AlterCommands.cpp:2147-2166 on this head rather than 2197-2211, adds the column's stored default to default_expr_list, and a subcommand carrying an explicit default already added its own at 2141. Give the second subcommand the advanced state and both entries alias c. That is measurable today, by pre-setting the default so validate() sees what an advance would show it:

CREATE TABLE t (event String, c UInt32 MATERIALIZED JSONExtractUInt(event, 'x')) ENGINE = MergeTree() ORDER BY tuple();
ALTER TABLE t MODIFY COLUMN c UInt32 MATERIALIZED JSONExtractUInt(event, 'x'),
              MODIFY COLUMN c UInt32 CODEC(T64, LZ4);   -- Code: 179 on both binaries

The primary repro would report that error instead of returning 42.

Validating each default once against the final post-ALTER state, your other suggestion, is a genuine change but a larger one: it has to define what two colliding expressions for one column mean. That belongs in its own PR rather than bundled with a wrong-results fix.

@clickhouse-gh

clickhouse-gh Bot commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing b4bc9754b with master f73529f03 (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

7 translation units recompiled, 15 s compile time in total, 7 of them have a recent master baseline.

Job report

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 79b6371

Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Stateless tests (amd_debug, parallel) / 04357_distributed_alias_same_expression flaky, master-reachable (the job's own randomized-settings diagnosis reads 15/73 reruns failed; 19 hits on master in 30d, 2026-07-28 to 2026-08-14, amd_debug + arm_binary) #108855 (ours, open)

CI is fully finished on this head: 177 leaves, 0 dropped, 158 OK / 18 skipped / 1 failure;
Config Workflow and Finish Workflow both green. The earlier Config Workflow / Pre Hooks
red at 12:15:27Z was a superseded run from before the can be tested label landed at 12:17:25Z;
the surviving run is green, so it is not a failure of this head.

The single red is mechanically unrelated to this change: this PR touches only AlterCommands.cpp
default-desc composition, while 04357 covers duplicate-ALIAS GROUP BY over a Distributed table
under two-level aggregation. #108855 owns that test and is still open.

Session id: cron:our-pr-ci-monitor:20260815-003000

@groeneai groeneai added the groeneai-origin-self PR origin: self-found defect (impact-bar validated) label Aug 19, 2026
@arsenmuk arsenmuk self-assigned this Aug 31, 2026
@arsenmuk

arsenmuk commented Sep 2, 2026

Copy link
Copy Markdown
Member

@groeneai please update the branch on this PR to the latest master

@groeneai

groeneai commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator Author

Updated: merged master 552cef42a06e1ba24edf3b7c4e87ed60252231c1 in, new head is 2c9789445fd7a4d00d43a87c21eb181723e96425. No conflicts, and the change against master is unchanged (same three files, identical patch id).

I rebuilt and re-ran the test on the merged tree: 04904_alter_two_modify_column_same_column_default passes there, and it still fails against a build of master from this morning (88dd163), so the defect is not fixed elsewhere. CI is running on the new head.

@groeneai

groeneai commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 2c97894

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens.

Check / test Reason Owner / fixing PR
Parser memory check / Resolve master binary CI infra, not caused by this diff: the job asks for a hand-spelled master clickhouse-examples S3 key that resolves in none of the tracked commits (No master clickhouse-examples artifact was found) #117701 (mine, merged 2026-09-02T16:49:23Z) - measured absent from the tree that ran (this build finished 16:41Z, eight minutes before that merge), so it is the owner and not a fix that already failed
LLVM Coverage / Generate LLVM Coverage Diff Report CI infra, not caused by this diff: ci/jobs/scripts/generate_diff_coverage_report.sh hand-spells the pre-cutover master prefix, so no baseline coverage file resolves for any tracked commit #117718 (external, open)
LLVM Coverage / Print Uncovered Code downstream consequence of the row above: the diff report failed, so the uncovered-code analysis never ran #117718 (external, open)

I am not merging master to pick up #117701 yet: LLVM Coverage is owned by an open PR, so a
merge could not turn this head green and would only cost another manual workflow approval.

Session id: cron:our-pr-ci-monitor:20260902-173000

@arsenmuk

arsenmuk commented Sep 4, 2026

Copy link
Copy Markdown
Member

@groeneai update to the latest master, and ensure green ci on this PR

@groeneai

groeneai commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator Author

Done: merged master f73529f0361a65d042b316f1318959630f948d88, no conflicts. The head is now b4bc9754b67177c5949db64b39740aa904d1bb0d and the branch is 0 commits behind master. CI is running.

Both blocking failures at the previous head had the same cause and neither is reachable from this diff: the S3 artifact-prefix cutover in #110081 broke two baseline lookups, and the previous base (2026-09-02T10:35Z) predated both fixes.

Both fixes are on the branch now. I will report back here when CI finishes, with an owner for anything still red.

if (command.codec)
{
/// `default_kind` is what the parser set: `validate` runs before `prepare`, which back-fills it from the table.
/// `default_kind` holds its enumerator's zero value unless `default_expression` is set.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apply() now preserves the running default across a later type restate, but validate() still checks REMOVE DEFAULT / MATERIALIZED / ALIAS against all_columns.getDefault(column_name) from the table's original metadata here. A minimal repro is:

CREATE TABLE t (c UInt32) ENGINE = MergeTree() ORDER BY tuple();
ALTER TABLE t
    MODIFY COLUMN c UInt32 DEFAULT 7,
    MODIFY COLUMN c REMOVE DEFAULT;

The two statements succeed separately, but the combined form still throws Column c doesn't have DEFAULT, because the second subcommand never sees the default the first one just wrote. So same-column MODIFY COLUMN composition is still broken for removals unless validate() advances the per-column default state before these checks.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed, and wider than stated: the same refusal fires with the two subcommands swapped, and with MATERIALIZED in place of DEFAULT. It is also pre-existing, and it cannot ride in this PR.

Measured on three binaries, same flags, arms separated behaviourally by the primary repro (master returns c = 0 with an empty default_kind, this head returns c = 5 / MATERIALIZED):

  • Your repro gives Code: 36. Column 'c' doesn't have DEFAULT, cannot remove it byte-identically on master 2f4969d6 and on this head b4bc9754, so it is not introduced here.
  • The two statements issued separately are accepted on both, so the asymmetry you point at is real.
  • A single ALTER TABLE t MODIFY COLUMN c REMOVE DEFAULT on a column with no default gives the same Code: 36. That is the mechanism: validate() never advances the per-column state, so an entitled removal and an unentitled one are indistinguishable to it.

I implemented your suggested remedy rather than argue it: after each MODIFY_COLUMN is checked, write its default into all_columns and clear it for a REMOVE, mirroring what ADD_COLUMN already does at :2117-2122 on this head. It does accept your repro, and it breaks the case this PR exists to fix:

Code: 179. Multiple expressions _CAST(c_tmp_alter..., 'UInt64') AS c and
_CAST(c_tmp_alter..., 'UInt32') AS c for alias c ... default expression and
column type are incompatible. (MULTIPLE_EXPRESSIONS_FOR_ALIAS)

Advancing the state makes one column carry two default expressions inside a single ALTER, one per restated type, and the default-versus-type compatibility analysis then sees both. A correct fix has to advance the state for the removal checks at :2199-2217 without feeding it to that analysis, which is a separate change in a function this PR does not modify. What this PR does change is unaffected: a pre-existing DEFAULT or MATERIALIZED, plus a type restate, plus the matching REMOVE, is accepted identically on both binaries.

One correction to my earlier reply on the test file: I declined that finding partly because it was reachable with a single subcommand. That reason does not hold for this shape, since the single-subcommand form is correctly refused, so composition is the whole defect here. I have widened the disclosure in the description to cover it.

@clickhouse-gh clickhouse-gh Bot added the comp-ddl DDL command coordination and execution (ON CLUSTER, DDL queue). label Sep 4, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Sep 4, 2026
Merged via the queue into ClickHouse:master with commit fa2685d Sep 5, 2026
174 checks passed
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 5, 2026
@clickgapai

Copy link
Copy Markdown
Contributor
Reproducer
CREATE TABLE t (event String, c UInt32) ENGINE = MergeTree() ORDER BY tuple();
ALTER TABLE t MODIFY COLUMN c UInt32 MATERIALIZED JSONExtractUInt(event, 'x'),
              MODIFY COLUMN c UInt32 CODEC(T64, LZ4);
INSERT INTO t (event) VALUES ('{"x":42}');
SELECT c FROM t;  -- 0 on 26.8/26.7/26.6/26.3/25.8, expected 42
SELECT default_kind FROM system.columns WHERE table = 't' AND name = 'c';  -- empty, expected MATERIALIZED

Results:

  • Reproduces on: 26.8, 26.7, 26.6, 26.3
  • Tested versions: master, 26.8, 26.7, 26.6, 26.3
  • Also tested (unsupported, context only): 26.2 reproduces
  • Fix merged on master (not re-verified: tested master build predates this PR's merge — a clean verdict is not attributable to the fix). The releases listed above still have the bug and need the backport.

CC component owner: @tuanpach @tavplubix

Analysis metadata

comp-ddl · Severity P2 · Finding phase_d_pr114807

  • Verified against master build dab9efce85ab (aarch64)
  • Could not test: master
Introducing change: predates `v22.3.20.29` (oldest testable release)
  • v22.3.20.29 is the oldest release with a downloadable binary for this reproducer, and it already reproduces — the introducing change predates it and cannot be identified from release builds.
  • Walked 6 release(s) below the supported window: still reproduces down to 25.8.
  • Secondary components: comp-testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-ddl DDL command coordination and execution (ON CLUSTER, DDL queue). groeneai-origin-self PR origin: self-found defect (impact-bar validated) pr-bugfix Pull request with bugfix, not backported by default pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants