diff --git a/dbms/tests/queries/0_stateless/00030_1_alter_table.reference b/dbms/tests/queries/0_stateless/00030_1_alter_table.reference new file mode 100644 index 00000000000..9fda58741f4 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00030_1_alter_table.reference @@ -0,0 +1,10 @@ +CounterID UInt32 +StartDate Date +UserID UInt32 +VisitID UInt32 +NestedColumn.A Array(UInt8) +NestedColumn.S Array(String) +ToDrop UInt32 +Added0 UInt32 +Added1 UInt32 +Added2 UInt32 diff --git a/dbms/tests/queries/0_stateless/00030_1_alter_table.sql b/dbms/tests/queries/0_stateless/00030_1_alter_table.sql new file mode 100644 index 00000000000..77d25d15cb4 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00030_1_alter_table.sql @@ -0,0 +1,11 @@ +DROP TABLE IF EXISTS alter_test; + +CREATE TABLE alter_test (CounterID UInt32, StartDate Date, UserID UInt32, VisitID UInt32, NestedColumn Nested(A UInt8, S String), ToDrop UInt32) ENGINE = MergeTree(StartDate, intHash32(UserID), (CounterID, StartDate, intHash32(UserID), VisitID), 8192); + +INSERT INTO alter_test VALUES (1, '2014-01-01', 2, 3, [1,2,3], ['a','b','c'], 4); + +ALTER TABLE alter_test ADD COLUMN Added0 UInt32; +ALTER TABLE alter_test ADD COLUMN Added2 UInt32; +ALTER TABLE alter_test ADD COLUMN Added1 UInt32 AFTER Added0; + +DESC TABLE alter_test; diff --git a/dbms/tests/queries/0_stateless/00030_2_alter_table.reference b/dbms/tests/queries/0_stateless/00030_2_alter_table.reference new file mode 100644 index 00000000000..8c47f345849 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00030_2_alter_table.reference @@ -0,0 +1,7 @@ +CounterID UInt32 +StartDate Date +UserID UInt32 +VisitID UInt32 +Added0 String +Added1 UInt32 +Added2 UInt32 diff --git a/dbms/tests/queries/0_stateless/00030_2_alter_table.sql b/dbms/tests/queries/0_stateless/00030_2_alter_table.sql new file mode 100644 index 00000000000..d6fd3cf4a4a --- /dev/null +++ b/dbms/tests/queries/0_stateless/00030_2_alter_table.sql @@ -0,0 +1,8 @@ +ALTER TABLE alter_test DROP COLUMN ToDrop; + +ALTER TABLE alter_test MODIFY COLUMN Added0 String; + +ALTER TABLE alter_test DROP COLUMN `NestedColumn.A`; +ALTER TABLE alter_test DROP COLUMN `NestedColumn.S`; + +DESC TABLE alter_test; diff --git a/dbms/tests/queries/0_stateless/00030_3_alter_table.reference b/dbms/tests/queries/0_stateless/00030_3_alter_table.reference new file mode 100644 index 00000000000..123652833e9 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00030_3_alter_table.reference @@ -0,0 +1 @@ +1 2014-01-01 2 3 0 0 diff --git a/dbms/tests/queries/0_stateless/00030_3_alter_table.sql b/dbms/tests/queries/0_stateless/00030_3_alter_table.sql new file mode 100644 index 00000000000..d7ecb07f159 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00030_3_alter_table.sql @@ -0,0 +1,3 @@ +SELECT * FROM alter_test; + +DROP TABLE alter_test;