ClickHouse/dbms/tests/queries/0_stateless/00615_nullable_alter_optimize.sql
Alexey Milovidov 4c2adf1f30 Fixed test #797
2018-04-06 02:00:19 +03:00

24 lines
550 B
SQL

USE test;
DROP TABLE IF EXISTS test;
CREATE TABLE test
(
dt Date,
id Int32,
key String,
data Nullable(Int8)
) ENGINE = MergeTree(dt, (id, key, dt), 8192);
INSERT INTO test (dt,id, key,data) VALUES ('2000-01-01', 100, 'key', 100500);
alter table test drop column data;
alter table test add column data Nullable(Float64);
INSERT INTO test (dt,id, key,data) VALUES ('2000-01-01', 100, 'key', 100500);
SELECT * FROM test ORDER BY data NULLS FIRST;
OPTIMIZE TABLE test;
SELECT * FROM test ORDER BY data NULLS FIRST;
DROP TABLE test;