dbms: added test for alter [#METR-10550]

This commit is contained in:
Pavel Kartavyy 2014-04-03 19:57:36 +04:00
parent d50aaf9368
commit 00d5cfbe45
6 changed files with 40 additions and 0 deletions

View File

@ -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

View File

@ -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;

View File

@ -0,0 +1,7 @@
CounterID UInt32
StartDate Date
UserID UInt32
VisitID UInt32
Added0 String
Added1 UInt32
Added2 UInt32

View File

@ -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;

View File

@ -0,0 +1 @@
1 2014-01-01 2 3 0 0

View File

@ -0,0 +1,3 @@
SELECT * FROM alter_test;
DROP TABLE alter_test;