Merge pull request #57259 from ClickHouse/ignore-column-comments

Ignore comments when comparing column descriptions
This commit is contained in:
Antonio Andelic 2023-11-27 20:43:39 +01:00 committed by GitHub
commit 544f6081eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 45 additions and 2 deletions

View File

@ -60,7 +60,6 @@ bool ColumnDescription::identical(const ColumnDescription & other) const
return name == other.name
&& type->identical(*other.type)
&& default_desc == other.default_desc
&& comment == other.comment
&& ast_to_str(codec) == ast_to_str(other.codec)
&& ast_to_str(ttl) == ast_to_str(other.ttl);
}
@ -72,7 +71,6 @@ bool ColumnDescription::operator==(const ColumnDescription & other) const
return name == other.name
&& type->equals(*other.type)
&& default_desc == other.default_desc
&& comment == other.comment
&& ast_to_str(codec) == ast_to_str(other.codec)
&& ast_to_str(ttl) == ast_to_str(other.ttl);
}

View File

@ -1351,3 +1351,48 @@ def test_replicated_table_structure_alter(started_cluster):
assert "1\t2\t3\t0\n1\t2\t3\t4\n" == dummy_node.query(
"SELECT * FROM table_structure.rmt ORDER BY k"
)
def test_modify_comment(started_cluster):
main_node.query(
"CREATE DATABASE modify_comment_db ENGINE = Replicated('/test/modify_comment', 'shard1', 'replica' || '1');"
)
dummy_node.query(
"CREATE DATABASE modify_comment_db ENGINE = Replicated('/test/modify_comment', 'shard1', 'replica' || '2');"
)
main_node.query(
"CREATE TABLE modify_comment_db.modify_comment_table (d Date, k UInt64, i32 Int32) ENGINE=ReplicatedMergeTree ORDER BY k PARTITION BY toYYYYMM(d);"
)
def restart_verify_not_readonly():
main_node.restart_clickhouse()
assert (
main_node.query(
"SELECT is_readonly FROM system.replicas WHERE table = 'modify_comment_table'"
)
== "0\n"
)
dummy_node.restart_clickhouse()
assert (
dummy_node.query(
"SELECT is_readonly FROM system.replicas WHERE table = 'modify_comment_table'"
)
== "0\n"
)
main_node.query(
"ALTER TABLE modify_comment_db.modify_comment_table COMMENT COLUMN d 'Some comment'"
)
restart_verify_not_readonly()
main_node.query(
"ALTER TABLE modify_comment_db.modify_comment_table MODIFY COMMENT 'Some error comment'"
)
restart_verify_not_readonly()
main_node.query("DROP DATABASE modify_comment_db SYNC")
dummy_node.query("DROP DATABASE modify_comment_db SYNC")