26
create table t1 (bandID INT NOT NULL PRIMARY KEY, payoutID int NOT NULL);
26
create table t1 (bandID INT UNSIGNED NOT NULL PRIMARY KEY, payoutID SMALLINT UNSIGNED NOT NULL);
27
27
insert into t1 (bandID,payoutID) VALUES (1,6),(2,6),(3,4),(4,9),(5,10),(6,1),(7,12),(8,12);
28
28
alter table t1 add column new_col int;
34
34
# Check that pack_keys and dynamic length rows are not forced.
37
GROUP_ID int DEFAULT '0' NOT NULL,
38
LANG_ID int DEFAULT '0' NOT NULL,
37
GROUP_ID int unsigned DEFAULT '0' NOT NULL,
38
LANG_ID smallint unsigned DEFAULT '0' NOT NULL,
39
39
NAME varchar(80) DEFAULT '' NOT NULL,
40
40
PRIMARY KEY (GROUP_ID,LANG_ID),
59
id int NOT NULL default '0',
60
category_id int NOT NULL default '0',
61
type_id int NOT NULL default '0',
59
id int unsigned NOT NULL default '0',
60
category_id tinyint unsigned NOT NULL default '0',
61
type_id tinyint unsigned NOT NULL default '0',
62
62
body text NOT NULL,
63
user_id int NOT NULL default '0',
63
user_id int unsigned NOT NULL default '0',
64
64
status enum('new','old') NOT NULL default 'new',
72
72
# The following combination found a hang-bug in MyISAM
75
CREATE TABLE t1 (AnamneseId int NOT NULL auto_increment,B BLOB,PRIMARY KEY (AnamneseId)) engine=myisam;
75
CREATE TABLE t1 (AnamneseId int unsigned NOT NULL auto_increment,B BLOB,PRIMARY KEY (AnamneseId)) engine=myisam;
76
76
insert into t1 values (null,"hello");
77
77
LOCK TABLES t1 WRITE;
78
78
ALTER TABLE t1 ADD Column new_col int not null;
84
84
# Drop and add an auto_increment column
87
create table t1 (i int not null auto_increment primary key);
87
create table t1 (i int unsigned not null auto_increment primary key);
88
88
insert into t1 values (null),(null),(null),(null);
89
alter table t1 drop i,add i int not null auto_increment, drop primary key, add primary key (i);
89
alter table t1 drop i,add i int unsigned not null auto_increment, drop primary key, add primary key (i);
252
252
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;
253
253
insert into t1 (a) values(1);
254
--replace_column 3 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X
254
--replace_column 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X
255
255
show table status like 't1';
256
256
alter table t1 modify a int;
257
--replace_column 3 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X
257
--replace_column 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X
258
258
show table status like 't1';
260
260
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;
261
261
insert into t1 (a) values(1);
262
--replace_column 3 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X
262
--replace_column 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X
263
263
show table status like 't1';
267
# Test that data get converted when character set is changed
268
# Test that data doesn't get converted when src or dst is BINARY/BLOB
271
create table t1 (a char(10) character set koi8r);
272
insert into t1 values ('����');
273
select a,hex(a) from t1;
274
alter table t1 change a a char(10) character set cp1251;
275
select a,hex(a) from t1;
276
alter table t1 change a a varbinary(4);
277
select a,hex(a) from t1;
278
alter table t1 change a a char(10) character set cp1251;
279
select a,hex(a) from t1;
280
alter table t1 change a a char(10) character set koi8r;
281
select a,hex(a) from t1;
282
alter table t1 change a a varchar(10) character set cp1251;
283
select a,hex(a) from t1;
284
alter table t1 change a a char(10) character set koi8r;
285
select a,hex(a) from t1;
286
alter table t1 change a a text character set cp1251;
287
select a,hex(a) from t1;
288
alter table t1 change a a char(10) character set koi8r;
289
select a,hex(a) from t1;
293
# Test ALTER TABLE .. CHARACTER SET ..
295
show create table t1;
296
alter table t1 DEFAULT CHARACTER SET latin1;
297
show create table t1;
298
alter table t1 CONVERT TO CHARACTER SET latin1;
299
show create table t1;
300
alter table t1 DEFAULT CHARACTER SET cp1251;
301
show create table t1;
307
# Test that table CHARACTER SET does not affect blobs
309
create table t1 (myblob longblob,mytext longtext)
310
default charset latin1 collate latin1_general_cs;
311
show create table t1;
312
alter table t1 character set latin2;
313
show create table t1;
267
317
# Bug 2361 (Don't drop UNIQUE with DROP PRIMARY KEY)
293
343
DROP TABLE T12207;
346
# Bug #6479 ALTER TABLE ... changing charset fails for TEXT columns
348
# The column's character set was changed but the actual data was not
349
# modified. In other words, the values were reinterpreted
350
# as UTF8 instead of being converted.
351
create table t1 (a text) character set koi8r;
352
insert into t1 values (_koi8r'����');
353
select hex(a) from t1;
354
alter table t1 convert to character set cp1251;
355
select hex(a) from t1;
296
359
# Test for bug #7884 "Able to add invalid unique index on TIMESTAMP prefix"
297
360
# MySQL should not think that packed field with non-zero decimals is
298
361
# geometry field and allow to create prefix index which is
613
676
# without # prefix is not allowed for TEXT columns, while index
614
677
# is defined with prefix.
616
create table t1 (t varchar(255) default null, key t (t(80))) engine=myisam;
679
create table t1 (t varchar(255) default null, key t (t(80)))
680
engine=myisam default charset=latin1;
617
681
alter table t1 change t t text;
777
841
INSERT INTO t1 VALUES (1, "edno"), (1, "edno"), (2, "dve"), (3, "tri"), (5, "pet");
778
842
--echo "Non-copy data change - new frm, but old data and index files"
779
ALTER TABLE t1 CHANGE int_field unsigned_int_field INTEGER NOT NULL, RENAME t2;
844
CHANGE int_field unsigned_int_field INTEGER UNSIGNED NOT NULL,
781
847
--error ER_NO_SUCH_TABLE
782
848
SELECT * FROM t1 ORDER BY int_field;
783
849
SELECT * FROM t2 ORDER BY unsigned_int_field;
786
ALTER TABLE t2 MODIFY unsigned_int_field BIGINT NOT NULL;
852
ALTER TABLE t2 MODIFY unsigned_int_field BIGINT UNSIGNED NOT NULL;