summaryrefslogtreecommitdiff
path: root/storage/tokudb/mysql-test/tokudb_alter_table/t/test_field_same_detection.test
blob: 37ed9cca0643c9c51fd3aa03901129598419686d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
--source include/have_tokudb.inc
SET DEFAULT_STORAGE_ENGINE='tokudb';

--disable_warnings
DROP TABLE IF EXISTS foo,bar;
--enable_warnings

set session tokudb_disable_slow_alter=ON;


create table foo (
a1 int,
a2 int unsigned,
a3 tinyint,
a4 tinyint unsigned,
a5 bit,
a6 smallint,
a7 smallint unsigned,
a8 mediumint,
a9 mediumint unsigned,
a10 bigint,
a11 bigint unsigned,
a12 double,
a13 double unsigned,
a14 float,
a15 float unsigned,
a16 decimal,
a17 date,
a18 datetime,
a19 timestamp,
a20 time,
a21 year,
a22 binary(100),
a23 varbinary(100),
a24 varchar(10),
a25 varchar(10) CHARACTER SET latin1 COLLATE latin1_general_cs,
a26 char(10),
a27 char(10) CHARACTER SET latin1 COLLATE latin1_general_cs,
a28 ENUM('a','b','c') CHARACTER SET binary,
a29 tinyblob,
a30 tinytext CHARACTER SET latin1 COLLATE latin1_general_cs,
a31 blob,
a32 text CHARACTER SET latin1 COLLATE latin1_general_cs,
a33 mediumblob,
a34 mediumtext CHARACTER SET latin1 COLLATE latin1_general_cs,
a35 longblob,
a36 longtext CHARACTER SET latin1 COLLATE latin1_general_cs
)engine = TokuDB;

alter table foo add column b int;
drop table foo;

create table foo (a tinyint NOT NULL)engine=TokuDB;
insert into foo values(1),(0),(-1);
select * from foo;

alter table foo add column a5 bit(8) NOT NULL default b'1' first;
show create table foo;
select a5+0,a from foo;
alter table foo drop column a5;
select * from foo;

alter table foo add column b smallint NOT NULL default -1 first;
select * from foo;
alter table foo drop column b;

alter table foo add column b mediumint NOT NULL default -1 first;
select * from foo;
alter table foo drop column b;

alter table foo add column b double NOT NULL default -1.0 first;
select * from foo;
alter table foo drop column b;

alter table foo add column b float NOT NULL default -1.0 first;
select * from foo;
alter table foo drop column b;

alter table foo add column b date NOT NULL default '1981-11-01' first;
select * from foo;
alter table foo drop column b;

alter table foo add column b datetime NOT NULL default '1981-11-01 17:17:17' first;
select * from foo;
alter table foo drop column b;

alter table foo add column b timestamp NOT NULL default '1981-11-01 17:17:17' first;
select * from foo;
alter table foo drop column b;

alter table foo add column b time NOT NULL default '17:17:17' first;
select * from foo;
alter table foo drop column b;

alter table foo add column b year NOT NULL default '1981' first;
select * from foo;
alter table foo drop column b;

alter table foo add column b binary(255) NOT NULL default "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" first;
select * from foo;
alter table foo drop column b;

alter table foo add column b varbinary(255) NOT NULL default "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" first;
select * from foo;
alter table foo drop column b;

alter table foo add column b char(255) NOT NULL default "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" first;
select * from foo;
alter table foo drop column b;

alter table foo add column b varchar(255) NOT NULL default "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" first;
select * from foo;
alter table foo drop column b;

alter table foo add column b ENUM('a','b','c') CHARACTER SET binary NOT NULL default 'b' first;
select * from foo;
alter table foo drop column b;

alter table foo add column b blob first;
select * from foo;
alter table foo drop column b;

alter table foo add column b tinyblob first;
select * from foo;
alter table foo drop column b;

alter table foo add column b mediumblob first;
select * from foo;
alter table foo drop column b;

alter table foo add column b longblob first;
select * from foo;
alter table foo drop column b;

alter table foo add column b text first;
select * from foo;
alter table foo drop column b;

alter table foo add column b tinytext first;
select * from foo;
alter table foo drop column b;

alter table foo add column b mediumtext first;
select * from foo;
alter table foo drop column b;

alter table foo add column b longtext first;
select * from foo;
alter table foo drop column b;

drop table foo;