Recalculate always projections on mutations in ReplicatedMergeTree

This commit is contained in:
Antonio Andelic 2023-03-22 11:21:12 +00:00
parent 67bb647a54
commit b832840cf3
3 changed files with 19 additions and 0 deletions

View File

@ -456,6 +456,14 @@ StorageInMemoryMetadata ReplicatedMergeTreeTableMetadata::Diff::getNewMetadata(c
new_metadata.table_ttl = TTLTableDescription::getTTLForTableFromAST(
new_metadata.table_ttl.definition_ast, new_metadata.columns, context, new_metadata.primary_key);
if (!projections_changed)
{
ProjectionsDescription recalculated_projections;
for (const auto & projection : new_metadata.projections)
recalculated_projections.add(ProjectionDescription::getProjectionFromAST(projection.definition_ast, new_metadata.columns, context));
new_metadata.projections = std::move(recalculated_projections);
}
return new_metadata;
}

View File

@ -0,0 +1,11 @@
DROP TABLE IF EXISTS 02691_drop_column_replicated;
CREATE TABLE 02691_drop_column_replicated (col1 Int64, col2 Int64, PROJECTION 02691_drop_column_replicated (SELECT * ORDER BY col1 ))
ENGINE = ReplicatedMergeTree('/clickhouse/tables/{database}/test/02691_drop_column', 'r1')
ORDER BY col1;
INSERT INTO 02691_drop_column_replicated VALUES (1, 2);
ALTER TABLE 02691_drop_column_replicated DROP COLUMN col2 SETTINGS alter_sync = 2;
DROP TABLE 02691_drop_column_replicated;