Skip to content

Inject ON CLUSTER for LIVE VIEW and WINDOW VIEW restored with explicit column lists#1433

Open
mvanhorn wants to merge 1 commit into
Altinity:masterfrom
mvanhorn:fix/1423-on-cluster-live-window-view
Open

Inject ON CLUSTER for LIVE VIEW and WINDOW VIEW restored with explicit column lists#1433
mvanhorn wants to merge 1 commit into
Altinity:masterfrom
mvanhorn:fix/1423-on-cluster-live-window-view

Conversation

@mvanhorn

Copy link
Copy Markdown
Contributor

Summary

restore_schema_on_cluster now inserts ON CLUSTER in 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. Plain CREATE VIEW, views with an explicit column list, and views with a TO/ENGINE clause are all handled without regression.

Why this matters

ClickHouse expects ON CLUSTER before the column list, TO target, and storage clauses, but the rewrite placed it after them for view types, producing invalid DDL that the server rejected. As a result restore_schema_on_cluster could not restore LIVE/WINDOW/MATERIALIZED views. The rewrite now positions ON CLUSTER correctly 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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

restore_schema_on_cluster: LIVE VIEW and WINDOW VIEW restored without ON CLUSTER

1 participant