Skip to content

Docs: clarify CLONE AS statement - #118620

Merged
Blargian merged 3 commits into
masterfrom
Blargian-patch-26
Sep 9, 2026
Merged

Blargian merged 3 commits into
masterfrom
Blargian-patch-26

Conversation

@Blargian

@Blargian Blargian commented Sep 7, 2026 •

Copy link
Copy Markdown
Member

Based on testing the statement is not true:

clickhouse-cloud :) CREATE TABLE internal.query_log_clone CLONE AS internal.query_log

Received exception from server (version 26.9.1):
Code: 344. DB::Exception: Received from XXX. DB::Exception: CREATE CLONE AS is not supported with Replicated databases. Consider using separate CREATE and INSERT queries.. (SUPPORT_IS_DISABLED)

clickhouse-cloud :) CREATE TABLE internal.query_log_clone AS internal.query_log

Ok.
0 rows in set. Elapsed: 0.274 sec.

clickhouse-cloud :) ALTER TABLE internal.query_log_clone ATTACH PARTITION ALL FROM internal.query_log

ALTER TABLE internal.query_log_clone
    (ATTACH PARTITION ALL FROM internal.query_log)

Ok.
0 rows in set. Elapsed: 5.882 sec.

Changelog category (leave one):

  • Documentation (changelog entry is not required)

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

...


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

Version info

  • Merged into: 26.9.1.1078 (included in 26.9 and later)

@clickhouse-gh

clickhouse-gh Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [aa09044]

Summary: ✅


AI Review

Summary

This PR updates the CREATE TABLE ... CLONE AS statement documentation source to note that Replicated databases reject the shorthand and to recommend the manual two-step replacement. The clarification is directionally correct, but one user-facing surface is still out of sync with it.

Findings

💡 Nits

  • [src/Parsers/ParserCreateQuery.cpp:2114] The new docs-source text recommends CREATE TABLE ... AS ... followed by ALTER TABLE ... ATTACH PARTITION ALL FROM ..., but the unchanged CREATE CLONE AS exception in src/Interpreters/InterpreterCreateQuery.cpp:2127 still tells users to use separate CREATE and INSERT queries. That leaves the reference docs and the runtime diagnostic contradicting each other for the same unsupported case. Suggested fix: update the exception text to match the documented workaround.
Final Verdict

✅ No blocking issues found, but the CREATE CLONE AS diagnostic should be aligned with the new documented workaround before merge if you want the clarification to be complete.

LLVM Coverage Report

Measured on commit aa09044.

Metric Baseline Current Δ
Lines 88.80% 88.80% +0.00%
Functions 91.80% 91.80% +0.00%
Branches 81.10% 81.20% +0.10%

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

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-documentation Documentation PRs for the specific code PR label Sep 7, 2026
<Note>
`CLONE AS` is not supported when the destination database uses the [Replicated](/reference/engines/database-engines/replicated) database engine.

Instead use:

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.

The new note documents CREATE TABLE ... AS ...; ALTER TABLE ... ATTACH PARTITION ALL FROM ...; as the workaround for CLONE AS in Replicated databases, but the actual exception for this case still says Consider using separate CREATE and INSERT queries. in src/Interpreters/InterpreterCreateQuery.cpp:2127. Since CLONE AS itself is implemented by issuing ATTACH PARTITION ALL FROM later in the interpreter (src/Interpreters/InterpreterCreateQuery.cpp:3181-3205), the docs and the runtime diagnostic now point users to different replacement flows. Please align the exception text in the same change so the user-facing guidance stays consistent.

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.

@Blargian - what do you think about the scope here with this suggestion? I've run into similar. I argue that this change is not necessary to make the documentation accurate, and that changing runtime output is probably better suited to a separate change.

@clickhouse-gh

clickhouse-gh Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing aa09044bb with master d6eead06e (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of f0310cf12; 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, 8 s compile time in total, 7 of them have a recent master baseline.

Job report

@Blargian
Blargian added this pull request to the merge queue Sep 9, 2026
Merged via the queue into master with commit 3805e83 Sep 9, 2026
175 checks passed
@Blargian
Blargian deleted the Blargian-patch-26 branch September 9, 2026 20:35
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-documentation Documentation (docs, examples, READMEs). pr-documentation Documentation PRs for the specific code PR 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.

3 participants