mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Add check whether enums have the same underlying type or not
This commit is contained in:
parent
ac2e9a27e6
commit
6dad70a1fb
@ -501,7 +501,9 @@ namespace
|
||||
if (!which.isEnum())
|
||||
return false;
|
||||
IDataTypeEnum const* enum_type = dynamic_cast<IDataTypeEnum const*>(lhs);
|
||||
return enum_type->contains(*rhs);
|
||||
if (!enum_type->contains(*rhs))
|
||||
return false;
|
||||
return enum_type->getMaximumSizeOfValueInMemory() == rhs->getMaximumSizeOfValueInMemory();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,12 @@
|
||||
drop table if exists enum_alter_issue;
|
||||
create table enum_alter_issue (a Enum16('one' = 1, 'two' = 2), b Int)
|
||||
engine = ReplicatedMergeTree('/clickhouse/tables/{database}/test_02012/enum_alter_issue', 'r2')
|
||||
ORDER BY b;
|
||||
|
||||
insert into enum_alter_issue values ('one', 1), ('two', 1);
|
||||
alter table enum_alter_issue detach partition id 'all';
|
||||
alter table enum_alter_issue modify column a Enum8('one' = 1, 'two' = 2, 'three' = 3);
|
||||
insert into enum_alter_issue values ('one', 1), ('two', 1);
|
||||
|
||||
alter table enum_alter_issue attach partition id 'all'; -- {serverError TYPE_MISMATCH}
|
||||
drop table enum_alter_issue;
|
Loading…
Reference in New Issue
Block a user