329
329
# Test of creating table with too long key
332
--error ER_TOO_LONG_KEY
333
333
CREATE TEMPORARY TABLE t1 (a varchar(300), b varchar(300), c varchar(300), d varchar(300), e varchar(300), KEY t1 (a, b, c, d, e)) ENGINE=MyISAM;
334
334
CREATE TEMPORARY TABLE t1 (a varchar(300), b varchar(300), c varchar(300), d varchar(300), e varchar(300)) ENGINE=MyISAM;
335
--error ER_TOO_LONG_KEY
336
336
ALTER TABLE t1 ADD INDEX t1 (a, b, c, d, e);
343
343
CREATE TEMPORARY TABLE t1 (a int not null, b int, c int, key(b), key(c), key(a,b), key(c,a)) ENGINE=MyISAM;
344
344
INSERT into t1 values (0, null, 0), (0, null, 1), (0, null, 2), (0, null,3), (1,1,4);
345
create temporary table t2 (a int not null, b int, c int, key(b), key(c), key(a)) engine=myisam;
345
create table t2 (a int not null, b int, c int, key(b), key(c), key(a));
346
346
INSERT into t2 values (1,1,1), (2,2,2);
347
347
alter table t1 ENGINE=MYISAM;
348
348
show index from t1;
361
361
# Test bug when updating a split dynamic row where keys are not changed
364
create temporary table t1 (a int not null auto_increment primary key, b varchar(255)) engine=myisam;
364
create table t1 (a int not null auto_increment primary key, b varchar(255));
365
365
insert into t1 (b) values (repeat('a',100)),(repeat('b',100)),(repeat('c',100));
366
366
update t1 set b=repeat(left(b,1),200) where a=1;
442
442
# Verify blob handling
444
create temporary table t1 (a blob) engine=myisam;
444
create table t1 (a blob);
445
445
insert into t1 values('a '),('a');
446
446
select concat(a,'.') from t1 where a='a';
447
447
select concat(a,'.') from t1 where a='a ';
454
454
# Test text and unique
456
create temporary table t1 (a int not null auto_increment primary key, b text not null, unique b (b(20))) engine=myisam;
456
create table t1 (a int not null auto_increment primary key, b text not null, unique b (b(20)));
457
457
insert into t1 (b) values ('a'),('b'),('c');
458
458
select concat(b,'.') from t1;
459
459
update t1 set b='b ' where a=2;
470
470
# Test keys with 0 segments. (Bug #3203)
472
create temporary table t1 (a int not null) engine=myisam;
473
create temporary table t2 (a int not null, primary key (a)) engine=myisam;
472
create table t1 (a int not null);
473
create table t2 (a int not null, primary key (a));
474
474
insert into t1 values (1);
475
475
insert into t2 values (1),(2);
476
476
select sql_big_result distinct t1.a from t1,t2 order by t2.a;
495
495
# End of 4.0 tests
497
create temporary table t1 (a int, b varchar(200), c text not null) engine=myisam;
498
create temporary table t2 (a int, b varchar(200), c text not null) engine=myisam;
497
create table t1 (a int, b varchar(200), c text not null);
498
create table t2 (a int, b varchar(200), c text not null);
499
499
insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
500
500
insert t2 select * from t1;
501
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
501
checksum table t1, t2, t3;
502
checksum table t1, t2, t3;
503
checksum table t1, t2, t3;
503
505
drop table t1,t2;
505
507
#@TODO Figure out what the heck the below is testing.
532
534
# index search for NULL in blob. Bug #4816
534
create temporary table t1 ( a tinytext, b char(1), index idx (a(1),b) ) engine=myisam;
536
create table t1 ( a tinytext, b char(1), index idx (a(1),b) );
535
537
insert into t1 values (null,''), (null,'');
536
538
explain select count(*) from t1 where a is null;
537
539
select count(*) from t1 where a is null;
541
543
# bug9188 - Corruption Can't open file: 'table.MYI' (errno: 145)
543
create temporary table t1 (c1 int, c2 varchar(4) not null default '',
544
key(c2(3))) engine=myisam;
545
create table t1 (c1 int, c2 varchar(4) not null default '',
545
547
insert into t1 values (1,'A'), (2, 'B'), (3, 'A');
546
548
update t1 set c2='A B' where c1=2;
554
# Bug#12296 - CHECKSUM TABLE reports 0 for the table
555
# This happened if the first record was marked as deleted.
557
create table t1 (c1 int);
558
insert into t1 values (1),(2),(3),(4);
560
delete from t1 where c1 = 1;
561
create table t2 as select * from t1;
562
# The following returns 0 with the bug in place.
564
# The above should give the same number as the following.
550
568
# BUG#13814 - key value packed incorrectly for TINYBLOBs
552
create temporary table t1(
553
571
cip INT NOT NULL,
554
572
score INT NOT NULL DEFAULT 0,
558
576
insert into t1 (cip) VALUES (1), (2), (3);
559
577
insert into t1 (cip, bob) VALUES (4, 'a' ), (5, 'b'),
597
615
# Bug#8283 - OPTIMIZE TABLE causes data loss
617
SET GLOBAL myisam_repair_threads=2;
618
SHOW VARIABLES LIKE 'myisam_repair%';
599
620
# Test OPTIMIZE. This creates a new data file.
600
621
CREATE TEMPORARY TABLE t1 (
601
622
`_id` int NOT NULL default '0',
629
650
SELECT _id FROM t1;
630
651
DELETE FROM t1 WHERE _id < 8;
631
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
632
show table status LIKE 't1';
652
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
653
SHOW TABLE STATUS LIKE 't1';
634
655
ALTER TABLE t1 ENGINE=MYISAM;
636
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
637
show table status LIKE 't1';
657
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
658
SHOW TABLE STATUS LIKE 't1';
638
659
SELECT _id FROM t1;
662
SET GLOBAL myisam_repair_threads=1;
663
SHOW VARIABLES LIKE 'myisam_repair%';
642
666
# Bug#24607 - MyISAM pointer size determined incorrectly
644
668
CREATE TEMPORARY TABLE t1 (c1 TEXT) ENGINE=MyISAM;
645
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
646
show table status like 't1';
669
--replace_column 5 X 6 X 7 X 9 X 10 X 11 X 12 X 13 X 14 X 16 X
670
SHOW TABLE STATUS LIKE 't1';
805
829
# Some errors/warnings on create
808
--error ER_TOO_BIG_FIELDLENGTH
809
833
create temporary table t1 (v varchar(65530), key(v));
810
--error ER_TOO_BIG_FIELDLENGTH
811
835
create temporary table t1 (v varchar(65536));
812
--error ER_TOO_BIG_FIELDLENGTH
813
837
create temporary table t1 (v varchar(65530));
815
839
# MyISAM specific varchar tests
816
--error ER_TOO_BIG_FIELDLENGTH
817
841
create temporary table t1 (v varchar(65535));
819
843
eval set storage_engine=$default;
822
846
# BUG#9622 - ANALYZE TABLE and ALTER TABLE .. ENABLE INDEX produce
823
847
# different statistics on the same table with NULL values.
824
create temporary table t1 (a int, key(a)) engine=myisam;
848
create table t1 (a int, key(a));
826
850
insert into t1 values (1),(2),(3),(4),(NULL),(NULL),(NULL),(NULL);
827
851
analyze table t1;
854
878
# Bug#4692 - DISABLE/ENABLE KEYS waste a space
856
880
CREATE TEMPORARY TABLE t1 (c1 INT, c2 INT, UNIQUE INDEX (c1), INDEX (c2)) ENGINE=MYISAM;
857
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
858
show table status like 't1';
881
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
882
SHOW TABLE STATUS LIKE 't1';
859
883
INSERT INTO t1 VALUES (1,1);
860
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
861
show table status like 't1';
862
ALTER TABLE t1 DISABLE KEYS;
863
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
864
show table status like 't1';
865
ALTER TABLE t1 ENABLE KEYS;
866
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
867
show table status like 't1';
868
ALTER TABLE t1 DISABLE KEYS;
869
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
870
show table status like 't1';
871
ALTER TABLE t1 ENABLE KEYS;
872
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
873
show table status like 't1';
884
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
885
SHOW TABLE STATUS LIKE 't1';
886
ALTER TABLE t1 DISABLE KEYS;
887
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
888
SHOW TABLE STATUS LIKE 't1';
889
ALTER TABLE t1 ENABLE KEYS;
890
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
891
SHOW TABLE STATUS LIKE 't1';
892
ALTER TABLE t1 DISABLE KEYS;
893
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
894
SHOW TABLE STATUS LIKE 't1';
895
ALTER TABLE t1 ENABLE KEYS;
896
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
897
SHOW TABLE STATUS LIKE 't1';
874
898
#--exec ls -log var/master-data/test/t1.MYI
875
899
#--exec myisamchk -dvv var/master-data/test/t1.MYI
876
900
#--exec myisamchk -iev var/master-data/test/t1.MYI
877
901
--echo # Enable keys with parallel repair
902
SET GLOBAL myisam_repair_threads=2;
878
903
ALTER TABLE t1 DISABLE KEYS;
879
904
ALTER TABLE t1 ENABLE KEYS;
905
SET GLOBAL myisam_repair_threads=1;
928
# Test of key_block_size
931
create temporary table t1 (a int not null, key `a` (a) key_block_size=1024) ENGINE=MyISAM;
932
show create table t1;
935
create temporary table t1 (a int not null, key `a` (a) key_block_size=2048) ENGINE=MyISAM;
936
show create table t1;
939
create temporary table t1 (a varchar(2048), key `a` (a)) ENGINE=MyISAM;
940
show create table t1;
943
create temporary table t1 (a varchar(2048), key `a` (a) key_block_size=1024) ENGINE=MyISAM;
944
show create table t1;
947
create temporary table t1 (a int not null, b varchar(2048), key (a), key(b)) ENGINE=MyISAM key_block_size=1024;
948
show create table t1;
949
alter table t1 key_block_size=2048;
950
show create table t1;
951
alter table t1 add c int, add key (c);
952
show create table t1;
953
alter table t1 key_block_size=0;
954
alter table t1 add d int, add key (d);
955
show create table t1;
958
create temporary table t1 (a int not null, b varchar(2048), key (a), key(b)) ENGINE=MyISAM key_block_size=8192;
959
show create table t1;
962
create temporary table t1 (a int not null, b varchar(2048), key (a) key_block_size=1024, key(b)) ENGINE=MyISAM key_block_size=8192;
963
show create table t1;
966
create temporary table t1 (a int not null, b int, key (a) key_block_size=1024, key(b) key_block_size=8192) ENGINE=MyISAM key_block_size=16384;
967
show create table t1;
971
# Test limits and errors of key_block_size
973
create temporary table t1 (a int not null, key `a` (a) key_block_size=512) ENGINE=MyISAM;
974
show create table t1;
977
create temporary table t1 (a varchar(2048), key `a` (a) key_block_size=1000000000000000000) ENGINE=MyISAM;
978
show create table t1;
981
create temporary table t1 (a int not null, key `a` (a) key_block_size=1025) ENGINE=MyISAM;
982
show create table t1;
986
create temporary table t1 (a int not null, key key_block_size=1024 (a)) ENGINE=MyISAM;
988
create temporary table t1 (a int not null, key `a` key_block_size=1024 (a)) ENGINE=MyISAM;
902
991
# Bug#22119 - Changing MI_KEY_BLOCK_LENGTH makes a wrong myisamchk
904
993
CREATE temporary TABLE t1 (