create table XXX (x Nullable(String), y String) engine=MergeTree order by tuple();
insert into XXX (y) values ('a');
select * from XXX
┌─x────┬─y─┐
│ ᴺᵁᴸᴸ │ a │
└──────┴───┘
ALTER TABLE XXX MODIFY COLUMN x String;
DB::Exception: Cannot convert NULL value to non-Nullable type.
ALTER TABLE XXX MODIFY COLUMN x String DEFAULT 'xxx';
DB::Exception: Cannot convert NULL value to non-Nullable type.
alter table XXX update x ='xxx' where 1;
select * from XXX
┌─x───┬─y─┐
│ xxx │ a │
└─────┴───┘
ALTER TABLE XXX MODIFY COLUMN x String;
DB::Exception: Cannot convert NULL value to non-Nullable type
Though,
drop table XXX;
create table XXX (x Nullable(String), y String) engine=MergeTree order by tuple();
ALTER TABLE XXX MODIFY COLUMN x String DEFAULT 'xxx';
Ok.
DESCRIBE TABLE XXX
┌─name─┬─type───┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┬─ttl_expression─┐
│ x │ String │ DEFAULT │ 'xxx' │ │ │ │
│ y │ String │ │ │ │ │ │
└──────┴────────┴──────────────┴────────────────────┴─────────┴──────────────────┴────────────────┘