mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Merge pull request #23483 from hexiaoting/dev_alter_bugfix
Fix bug when modify column without type
This commit is contained in:
commit
f27002b1be
@ -1578,6 +1578,7 @@ void MergeTreeData::checkAlterIsPossible(const AlterCommands & commands, Context
|
||||
const IDataType * new_type = command.data_type.get();
|
||||
const IDataType * old_type = old_types[command.column_name];
|
||||
|
||||
if (new_type)
|
||||
checkVersionColumnTypesConversion(old_type, new_type, command.column_name);
|
||||
|
||||
/// No other checks required
|
||||
|
@ -0,0 +1 @@
|
||||
CREATE TABLE default.alter_test\n(\n `a` Int32,\n `b` DateTime DEFAULT now() + 1\n)\nENGINE = ReplacingMergeTree(b)\nORDER BY a\nSETTINGS index_granularity = 8192
|
@ -0,0 +1,6 @@
|
||||
DROP TABLE IF EXISTS alter_test;
|
||||
CREATE TABLE alter_test (a Int32, b DateTime) ENGINE = ReplacingMergeTree(b) ORDER BY a;
|
||||
ALTER TABLE alter_test MODIFY COLUMN `b` DateTime DEFAULT now();
|
||||
ALTER TABLE alter_test MODIFY COLUMN `b` DEFAULT now() + 1;
|
||||
SHOW CREATE TABLE alter_test;
|
||||
DROP TABLE alter_test;
|
Loading…
Reference in New Issue
Block a user