Inject ON CLUSTER for LIVE VIEW and WINDOW VIEW restored with explicit column lists#1433
Open
mvanhorn wants to merge 1 commit into
Open
Inject ON CLUSTER for LIVE VIEW and WINDOW VIEW restored with explicit column lists#1433mvanhorn wants to merge 1 commit into
mvanhorn wants to merge 1 commit into
Conversation
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.
Summary
restore_schema_on_clusternow insertsON CLUSTERin the syntactically valid position for LIVE, WINDOW, and MATERIALIZED views, so restoring those view definitions onto a cluster no longer fails with a syntax error. PlainCREATE VIEW, views with an explicit column list, and views with aTO/ENGINEclause are all handled without regression.Why this matters
ClickHouse expects
ON CLUSTERbefore the column list,TOtarget, and storage clauses, but the rewrite placed it after them for view types, producing invalid DDL that the server rejected. As a resultrestore_schema_on_clustercould not restore LIVE/WINDOW/MATERIALIZED views. The rewrite now positionsON CLUSTERcorrectly and distinguishes an engine call's parentheses from a column-list. Reported in #1423.Testing
Added targeted tests covering the view forms (plain, explicit column list, LIVE, WINDOW with engine+settings, MATERIALIZED with TO/ENGINE);
go test ./...passes.Closes #1423