14
14
col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null,
15
15
col6 int not null, to_be_deleted int);
16
16
insert into t1 values (2,4,3,5,"PENDING",1,7);
21
18
add column col4_5 varchar(20) not null after col4,
22
19
add column col7 varchar(30) not null after col5,
23
add column col8 datetime not null default '1000-01-01 00:00:00', drop column to_be_deleted,
24
change column col2 fourth varchar(30) not null after col3,
25
modify column col6 int not null first;
28
add column col4_5 varchar(20) DEFAULT "added" not null after col4,
29
add column col7 varchar(30) DEFAULT "added" not null after col5,
30
add column col8 datetime not null default '1000-01-01 00:00:00',
31
drop column to_be_deleted,
32
change column col2 fourth varchar(30) not null after col3,
33
modify column col6 int not null first;
20
add column col8 datetime not null, drop column to_be_deleted,
21
change column col2 fourth varchar(30) not null after col3,
22
modify column col6 int not null first;
167
155
# Test with two keys
170
CREATE TEMPORARY TABLE t1 (
171
Host varchar(16) NOT NULL default '',
172
User varchar(16) NOT NULL default '',
159
Host varchar(16) binary NOT NULL default '',
160
User varchar(16) binary NOT NULL default '',
173
161
PRIMARY KEY (Host,User),
177
165
ALTER TABLE t1 DISABLE KEYS;
179
167
INSERT INTO t1 VALUES ('localhost','root'),('localhost','');
181
169
ALTER TABLE t1 ENABLE KEYS;
211
199
# The following is also part of bug #6236 (CREATE TABLE didn't properly count
212
200
# not null columns for primary keys)
214
create TEMPORARY table t1 (a int, b int, c int, d int, e int, f int, g int, h int,i int, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM;
202
create table t1 (a int, b int, c int, d int, e int, f int, g int, h int,i int, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM;
215
203
insert into t1 (a,b,c,d,e,f,g,h,i) values(1,1,1,1,1,1,1,1,1);
216
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
204
--replace_column 3 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X
217
205
show table status like 't1';
218
206
alter table t1 modify a int;
219
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
207
--replace_column 3 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X
220
208
show table status like 't1';
222
create TEMPORARY table t1 (a int not null default 0, b int not null default 0, c int not null default 0, d int not null default 0, e int not null default 0, f int not null default 0, g int not null default 0, h int not null default 0,i int not null default 0, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM;
210
create table t1 (a int not null default 0, b int not null default 0, c int not null default 0, d int not null default 0, e int not null default 0, f int not null default 0, g int not null default 0, h int not null default 0,i int not null default 0, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM;
223
211
insert into t1 (a) values(1);
224
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
212
--replace_column 3 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X
225
213
show table status like 't1';
534
522
#create table t1(f1 int);
535
523
#alter table t1 add column f2 datetime not null, add column f21 date not null;
536
524
#insert into t1 values(1,'2000-01-01','2000-01-01');
537
#--error ER_TRUNCATED_WRONG_VALUE
538
526
#alter table t1 add column f3 datetime not null;
539
#--error ER_TRUNCATED_WRONG_VALUE
540
528
#alter table t1 add column f3 date not null;
541
#--error ER_TRUNCATED_WRONG_VALUE
542
530
#alter table t1 add column f4 datetime not null default '2002-02-02',
543
531
# add column f41 date not null;
544
532
#alter table t1 add column f4 datetime not null default '2002-02-02',