2020-06-20 11:29:01 +00:00
|
|
|
set send_logs_level = 'fatal';
|
2019-04-15 09:30:45 +00:00
|
|
|
|
2019-06-07 15:41:24 +00:00
|
|
|
drop table if exists ttl;
|
2019-04-15 09:30:45 +00:00
|
|
|
|
2020-11-15 02:24:47 +00:00
|
|
|
create table ttl (d Date, a Int) engine = MergeTree order by a partition by toDayOfMonth(d) settings remove_empty_parts = 0;
|
2019-06-07 15:41:24 +00:00
|
|
|
alter table ttl modify ttl d + interval 1 day;
|
|
|
|
show create table ttl;
|
|
|
|
insert into ttl values (toDateTime('2000-10-10 00:00:00'), 1);
|
|
|
|
insert into ttl values (toDateTime('2000-10-10 00:00:00'), 2);
|
|
|
|
insert into ttl values (toDateTime('2100-10-10 00:00:00'), 3);
|
|
|
|
insert into ttl values (toDateTime('2100-10-10 00:00:00'), 4);
|
|
|
|
optimize table ttl partition 10 final;
|
2019-04-15 09:30:45 +00:00
|
|
|
|
2022-02-02 15:15:20 +00:00
|
|
|
select * from ttl order by d, a;
|
2019-04-15 09:30:45 +00:00
|
|
|
|
2024-05-30 12:27:25 +00:00
|
|
|
alter table ttl modify ttl a; -- { serverError BAD_TTL_EXPRESSION }
|
2019-04-15 09:30:45 +00:00
|
|
|
|
2019-06-07 15:41:24 +00:00
|
|
|
drop table if exists ttl;
|
2019-04-15 09:30:45 +00:00
|
|
|
|
2020-11-15 02:24:47 +00:00
|
|
|
create table ttl (d Date, a Int) engine = MergeTree order by tuple() partition by toDayOfMonth(d) settings remove_empty_parts = 0;
|
2019-06-07 15:41:24 +00:00
|
|
|
alter table ttl modify column a Int ttl d + interval 1 day;
|
|
|
|
desc table ttl;
|
2024-05-30 12:27:25 +00:00
|
|
|
alter table ttl modify column d Int ttl d + interval 1 day; -- { serverError ILLEGAL_TYPE_OF_ARGUMENT }
|
|
|
|
alter table ttl modify column d DateTime ttl d + interval 1 day; -- { serverError ALTER_OF_COLUMN_IS_FORBIDDEN }
|
2019-04-15 09:30:45 +00:00
|
|
|
|
2019-06-07 15:41:24 +00:00
|
|
|
drop table if exists ttl;
|