ndb_alter_table.result 3.76 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
a INT NOT NULL,
b INT NOT NULL
) ENGINE=ndbcluster;
INSERT INTO t1 VALUES (9410,9412);
ALTER TABLE t1 ADD COLUMN c int not null;
SELECT * FROM t1;
a	b	c
9410	9412	0
DROP TABLE t1;
create table t1 (
col1 int not null auto_increment primary key,
col2 varchar(30) not null,
col3 varchar (20) not null,
col4 varchar(4) not null,
col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null,
unknown's avatar
unknown committed
18
col6 int not null, to_be_deleted int)  ENGINE=ndbcluster;
unknown's avatar
unknown committed
19 20
show table status;
Name	Engine	Version	Row_format	Rows	Avg_row_length	Data_length	Max_data_length	Index_length	Data_free	Auto_increment	Create_time	Update_time	Check_time	Collation	Checksum	Create_options	Comment
21
t1	ndbcluster	9	Dynamic	100	0	0	NULL	0	0	1	NULL	NULL	NULL	latin1_swedish_ci	NULL		
unknown's avatar
unknown committed
22 23
insert into t1 values
(0,4,3,5,"PENDING",1,7),(NULL,4,3,5,"PENDING",1,7),(31,4,3,5,"PENDING",1,7), (7,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7), (100,4,3,5,"PENDING",1,7), (99,4,3,5,"PENDING",1,7), (8,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7);
unknown's avatar
unknown committed
24 25 26
show table status;
Name	Engine	Version	Row_format	Rows	Avg_row_length	Data_length	Max_data_length	Index_length	Data_free	Auto_increment	Create_time	Update_time	Check_time	Collation	Checksum	Create_options	Comment
t1	ndbcluster	9	Dynamic	100	0	0	NULL	0	0	102	NULL	NULL	NULL	latin1_swedish_ci	NULL		
27 28
select * from t1 order by col1;
col1	col2	col3	col4	col5	col6	to_be_deleted
unknown's avatar
unknown committed
29 30 31 32 33 34 35 36 37
0	4	3	5	PENDING	1	7
1	4	3	5	PENDING	1	7
7	4	3	5	PENDING	1	7
8	4	3	5	PENDING	1	7
31	4	3	5	PENDING	1	7
32	4	3	5	PENDING	1	7
99	4	3	5	PENDING	1	7
100	4	3	5	PENDING	1	7
101	4	3	5	PENDING	1	7
38 39 40 41 42 43
alter table t1
add column col4_5 varchar(20) not null after col4,
add column col7 varchar(30) not null after col5,
add column col8 datetime not null, drop column to_be_deleted,
change column col2 fourth varchar(30) not null after col3,
modify column col6 int not null first;
unknown's avatar
unknown committed
44 45 46
show table status;
Name	Engine	Version	Row_format	Rows	Avg_row_length	Data_length	Max_data_length	Index_length	Data_free	Auto_increment	Create_time	Update_time	Check_time	Collation	Checksum	Create_options	Comment
t1	ndbcluster	9	Dynamic	100	0	0	NULL	0	0	102	NULL	NULL	NULL	latin1_swedish_ci	NULL		
47
select * from t1 order by col1;
48
col6	col1	col3	fourth	col4	col4_5	col5	col7	col8
unknown's avatar
unknown committed
49 50 51 52 53 54 55 56 57
1	0	3	4	5		PENDING		0000-00-00 00:00:00
1	1	3	4	5		PENDING		0000-00-00 00:00:00
1	7	3	4	5		PENDING		0000-00-00 00:00:00
1	8	3	4	5		PENDING		0000-00-00 00:00:00
1	31	3	4	5		PENDING		0000-00-00 00:00:00
1	32	3	4	5		PENDING		0000-00-00 00:00:00
1	99	3	4	5		PENDING		0000-00-00 00:00:00
1	100	3	4	5		PENDING		0000-00-00 00:00:00
1	101	3	4	5		PENDING		0000-00-00 00:00:00
58
insert into t1 values (2, NULL,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
unknown's avatar
unknown committed
59 60 61
show table status;
Name	Engine	Version	Row_format	Rows	Avg_row_length	Data_length	Max_data_length	Index_length	Data_free	Auto_increment	Create_time	Update_time	Check_time	Collation	Checksum	Create_options	Comment
t1	ndbcluster	9	Dynamic	100	0	0	NULL	0	0	103	NULL	NULL	NULL	latin1_swedish_ci	NULL		
62 63
select * from t1 order by col1;
col6	col1	col3	fourth	col4	col4_5	col5	col7	col8
unknown's avatar
unknown committed
64 65 66 67 68 69 70 71 72 73
1	0	3	4	5		PENDING		0000-00-00 00:00:00
1	1	3	4	5		PENDING		0000-00-00 00:00:00
1	7	3	4	5		PENDING		0000-00-00 00:00:00
1	8	3	4	5		PENDING		0000-00-00 00:00:00
1	31	3	4	5		PENDING		0000-00-00 00:00:00
1	32	3	4	5		PENDING		0000-00-00 00:00:00
1	99	3	4	5		PENDING		0000-00-00 00:00:00
1	100	3	4	5		PENDING		0000-00-00 00:00:00
1	101	3	4	5		PENDING		0000-00-00 00:00:00
2	102	4	3	5	99	PENDING	EXTRA	2004-01-01 00:00:00
74
drop table t1;
75 76 77
DROP TABLE IF EXISTS t2;
create table t2 (a int NOT NULL PRIMARY KEY) engine=myisam;
alter table t2 engine=ndbcluster;
78
alter table t2 add c int;
79 80 81
delete from t2;
ERROR HY000: Got temporary error 1217 '1217' from ndbcluster
select count(*) from t2 where a+0 > 0;
82
count(*)
83
12001
84 85 86 87 88
truncate table t2;
select count(*) from t2;
count(*)
0
drop table t2;