ClickHouse/tests/queries/0_stateless/01006_ttl_with_default_2.sql

15 lines
589 B
MySQL
Raw Normal View History

2019-09-03 10:27:02 +00:00
DROP TABLE IF EXISTS ttl_with_default;
CREATE TABLE ttl_with_default (d DateTime, a Int default 777 ttl d + interval 5 SECOND) ENGINE = MergeTree ORDER BY d;
INSERT INTO ttl_with_default VALUES (now() - 1000, 1) (now() - 1000, 2) (now() + 1000, 3)(now() + 1000, 4);
SELECT sleep(0.7) FORMAT Null; -- wait if very fast merge happen
OPTIMIZE TABLE ttl_with_default FINAL;
2019-09-03 10:31:52 +00:00
-- check that after second merge there are still user defaults in column
2019-09-03 10:27:02 +00:00
SELECT sleep(0.7) FORMAT Null;
OPTIMIZE TABLE ttl_with_default FINAL;
SELECT a FROM ttl_with_default ORDER BY a;
2019-09-03 10:31:52 +00:00
DROP TABLE ttl_with_default;