fix(clickhouse): register table comments via command instead of inline CTAS - #6007
Merged
mday-io merged 1 commit intoSep 1, 2026
Merged
Conversation
…e CTAS ClickhouseEngineAdapter set COMMENT_CREATION_VIEW to COMMENT_COMMAND_ONLY but never set COMMENT_CREATION_TABLE, so it silently inherited the EngineAdapter default of IN_SCHEMA_DEF_CTAS. That default asserts the engine can embed COMMENT '...' inside a CREATE TABLE ... AS SELECT, which ClickHouse Cloud rejects with a syntax error (code 62, SYNTAX_ERROR). Setting COMMENT_CREATION_TABLE to COMMENT_COMMAND_ONLY keeps the comment out of the CTAS entirely and routes both the table description and the column descriptions through the post-create ALTER TABLE ... MODIFY COMMENT and ALTER TABLE ... COMMENT COLUMN paths, which the adapter already implements and which views already rely on. Fixes SQLMesh#5969 Signed-off-by: cookieark <aishwary.kantode@gmail.com>
mday-io
self-requested a review
September 1, 2026 13:21
mday-io
approved these changes
Sep 1, 2026
Collaborator
|
Good find. Thanks - approving and merging. |
Contributor
Author
|
Welcome ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #5969.
ClickhouseEngineAdaptersetsCOMMENT_CREATION_VIEWbut neverCOMMENT_CREATION_TABLE, so it falls back to the base defaultIN_SCHEMA_DEF_CTASand embedsCOMMENT '...'inCREATE TABLE ... AS SELECT, which Cloud rejects:Setting it to
COMMENT_COMMAND_ONLYkeeps the comment out of the CTAS and routes the table and column descriptions through the existingALTER TABLE ... MODIFY COMMENT/... COMMENT COLUMNpaths, same as views already do.Test Plan
Heads up: these tests only fail on Cloud. They pass against the Docker ClickHouse behind
make clickhouse-testboth before and after this change (I checked 24.7 and 26.8.1 — both accept the inlineCOMMENT), so I couldn't reproduce the Cloud failure locally.What I could verify is that the CTAS no longer carries a
COMMENTat all:Since the inline
COMMENTis gone entirely, its position no longer matters. Leaving the actual Cloud confirmation to theclickhouse-cloud-testjob here.Locally:
make clickhouse-test168 passed,make fast-test2621 passed,make styleclean.Checklist
make styleand fixed any issuesmake fast-test)git commit -s) per the DCO