251
257
int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982
252
258
int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990
253
259
int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998
254
int, i999 int, i1000 int, b blob) engine=myisam row_format=dynamic;
260
int, i999 int, i1000 int, b blob) row_format=dynamic;
255
261
insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
256
262
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
257
263
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
492
488
select c1 from t1 order by c1 limit 1;
492
# Bug #14400 Join could miss concurrently inserted row
495
create table t1 (a int not null, primary key(a));
496
create table t2 (a int not null, b int not null, primary key(a,b));
497
insert into t1 values (1),(2),(3),(4),(5),(6);
498
insert into t2 values (1,1),(2,1);
499
lock tables t1 read local, t2 read local;
500
select straight_join * from t1,t2 force index (primary) where t1.a=t2.a;
501
connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
502
insert into t2 values(2,0);
505
select straight_join * from t1,t2 force index (primary) where t1.a=t2.a;
510
CREATE TABLE t1 (c1 varchar(250) NOT NULL);
511
CREATE TABLE t2 (c1 varchar(250) NOT NULL, PRIMARY KEY (c1));
512
INSERT INTO t1 VALUES ('test000001'), ('test000002'), ('test000003');
513
INSERT INTO t2 VALUES ('test000002'), ('test000003'), ('test000004');
514
LOCK TABLES t1 READ LOCAL, t2 READ LOCAL;
515
SELECT t1.c1 AS t1c1, t2.c1 AS t2c1 FROM t1, t2
516
WHERE t1.c1 = t2.c1 HAVING t1c1 != t2c1;
517
connect (con1,localhost,root,,);
519
INSERT INTO t2 VALUES ('test000001'), ('test000005');
522
SELECT t1.c1 AS t1c1, t2.c1 AS t2c1 FROM t1, t2
523
WHERE t1.c1 = t2.c1 HAVING t1c1 != t2c1;
495
527
# End of 4.0 tests
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);
533
CREATE TABLE t1 (`a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', UNIQUE KEY `a` USING RTREE (`a`,`b`)) ENGINE=MyISAM;
534
# INSERT INTO t1 VALUES (1,1),(1,1);
535
# DELETE FROM rt WHERE a<1;
536
# DROP TABLE IF EXISTS t1;
538
create table t1 (a int, b varchar(200), c text not null) checksum=1;
539
create table t2 (a int, b varchar(200), c text not null) checksum=0;
499
540
insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
500
541
insert t2 select * from t1;
501
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
542
checksum table t1, t2, t3 quick;
543
checksum table t1, t2, t3;
544
checksum table t1, t2, t3 extended;
503
546
drop table t1,t2;
505
#@TODO Figure out what the heck the below is testing.
506
# It bombs the test with unknown system variables...
508
#create table t1 (a int, key (a));
510
#alter table t1 disable keys;
512
#create table t2 (a int);
514
#set @@rand_seed1=31415926,@@rand_seed2=2718281828;
519
# insert t2 values (rand()*100000);
522
#insert t1 select * from t2;
524
#alter table t1 enable keys;
526
#alter table t1 engine=MEMORY;
527
#alter table t1 disable keys;
548
create table t1 (a int, key (a));
550
alter table t1 disable keys;
552
create table t2 (a int);
554
set @@rand_seed1=31415926,@@rand_seed2=2718281828;
559
insert t2 values (rand()*100000);
562
insert t1 select * from t2;
564
alter table t1 enable keys;
566
alter table t1 engine=heap;
567
alter table t1 disable keys;
532
572
# index search for NULL in blob. Bug #4816
541
581
# bug9188 - Corruption Can't open file: 'table.MYI' (errno: 145)
543
583
create table t1 (c1 int, c2 varchar(4) not null default '',
584
key(c2(3))) default charset=utf8;
545
585
insert into t1 values (1,'A'), (2, 'B'), (3, 'A');
546
586
update t1 set c2='A B' where c1=2;
592
# Bug#12296 - CHECKSUM TABLE reports 0 for the table
593
# This happened if the first record was marked as deleted.
595
create table t1 (c1 int);
596
insert into t1 values (1),(2),(3),(4);
598
delete from t1 where c1 = 1;
599
create table t2 as select * from t1;
600
# The following returns 0 with the bug in place.
602
# The above should give the same number as the following.
607
# BUG#12232: New myisam_stats_method variable.
610
show variables like 'myisam_stats_method';
612
create table t1 (a int, key(a));
613
insert into t1 values (0),(1),(2),(3),(4);
614
insert into t1 select NULL from t1;
616
# default: NULLs considered inequal
619
insert into t1 values (11);
620
delete from t1 where a=11;
624
# Set nulls to be equal:
625
set myisam_stats_method=nulls_equal;
626
show variables like 'myisam_stats_method';
627
insert into t1 values (11);
628
delete from t1 where a=11;
633
insert into t1 values (11);
634
delete from t1 where a=11;
639
# Set nulls back to be equal
640
set myisam_stats_method=DEFAULT;
641
show variables like 'myisam_stats_method';
642
insert into t1 values (11);
643
delete from t1 where a=11;
648
insert into t1 values (11);
649
delete from t1 where a=11;
656
# WL#2609, CSC#XXXX: MyISAM
657
set myisam_stats_method=nulls_ignored;
658
show variables like 'myisam_stats_method';
661
a char(3), b char(4), c char(5), d char(6),
664
insert into t1 values ('bcd','def1', NULL, 'zz');
665
insert into t1 values ('bcd','def2', NULL, 'zz');
666
insert into t1 values ('bce','def1', 'yuu', NULL);
667
insert into t1 values ('bce','def2', NULL, 'quux');
674
set myisam_stats_method=DEFAULT;
550
677
# BUG#13814 - key value packed incorrectly for TINYBLOBs
553
680
cip INT NOT NULL,
554
682
score INT NOT NULL DEFAULT 0,
558
insert into t1 (cip) VALUES (1), (2), (3);
559
insert into t1 (cip, bob) VALUES (4, 'a' ), (5, 'b'),
686
insert into t1 (cip, time) VALUES (1, '00:01'), (2, '00:02'), (3,'00:03');
687
insert into t1 (cip, bob, time) VALUES (4, 'a', '00:04'), (5, 'b', '00:05'),
561
689
select * from t1 where bob is null and cip=1;
562
create index bug on t1 (bob(22), cip);
690
create index bug on t1 (bob(22), cip, time);
563
691
select * from t1 where bob is null and cip=1;
567
695
# Bug#14980 - COUNT(*) incorrect on MyISAM table with certain INDEX
569
create temporary table t1 (
570
698
id1 int not null auto_increment,
571
699
id2 int not null default '0',
725
# BUG#18036 - update of table joined to self reports table as crashed
727
CREATE TABLE t1(a CHAR(9), b VARCHAR(7)) ENGINE=MyISAM;
728
INSERT INTO t1(a) VALUES('xxxxxxxxx'),('xxxxxxxxx');
729
UPDATE t1 AS ta1,t1 AS ta2 SET ta1.b='aaaaaa',ta2.b='bbbbbb';
597
734
# Bug#8283 - OPTIMIZE TABLE causes data loss
736
SET @@myisam_repair_threads=2;
737
SHOW VARIABLES LIKE 'myisam_repair%';
599
739
# Test OPTIMIZE. This creates a new data file.
600
CREATE TEMPORARY TABLE t1 (
601
`_id` int NOT NULL default '0',
605
`loverlap` int default NULL,
606
`roverlap` int default NULL,
607
`lneighbor_id` int default NULL,
608
`rneighbor_id` int default NULL,
609
`length_` int default NULL,
612
`_obj_class` text NOT NULL,
614
UNIQUE KEY `sequence_name_index` (`name`(50)),
618
INSERT INTO t1 VALUES
619
(1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample1',''),
620
(2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample2',''),
621
(3,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample3',''),
622
(4,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample4',''),
623
(5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample5',''),
624
(6,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample6',''),
625
(7,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample7',''),
626
(8,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample8',''),
627
(9,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample9','');
630
DELETE FROM t1 WHERE _id < 8;
631
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
632
show table status LIKE 't1';
634
ALTER TABLE t1 ENGINE=MYISAM;
636
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
637
show table status LIKE 't1';
741
`_id` int(11) NOT NULL default '0',
745
`loverlap` int(11) default NULL,
746
`roverlap` int(11) default NULL,
747
`lneighbor_id` int(11) default NULL,
748
`rneighbor_id` int(11) default NULL,
749
`length_` int(11) default NULL,
750
`sequence` mediumtext,
752
`_obj_class` text NOT NULL,
754
UNIQUE KEY `sequence_name_index` (`name`(50)),
756
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
758
INSERT INTO t1 VALUES
759
(1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample1',''),
760
(2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample2',''),
761
(3,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample3',''),
762
(4,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample4',''),
763
(5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample5',''),
764
(6,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample6',''),
765
(7,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample7',''),
766
(8,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample8',''),
767
(9,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample9','');
770
DELETE FROM t1 WHERE _id < 8;
771
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
772
SHOW TABLE STATUS LIKE 't1';
773
CHECK TABLE t1 EXTENDED;
775
CHECK TABLE t1 EXTENDED;
776
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
777
SHOW TABLE STATUS LIKE 't1';
781
# Test REPAIR QUICK. This retains the old data file.
783
`_id` int(11) NOT NULL default '0',
787
`loverlap` int(11) default NULL,
788
`roverlap` int(11) default NULL,
789
`lneighbor_id` int(11) default NULL,
790
`rneighbor_id` int(11) default NULL,
791
`length_` int(11) default NULL,
792
`sequence` mediumtext,
794
`_obj_class` text NOT NULL,
796
UNIQUE KEY `sequence_name_index` (`name`(50)),
798
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
800
INSERT INTO t1 VALUES
801
(1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample1',''),
802
(2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample2',''),
803
(3,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample3',''),
804
(4,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample4',''),
805
(5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample5',''),
806
(6,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample6',''),
807
(7,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample7',''),
808
(8,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample8',''),
809
(9,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample9','');
812
DELETE FROM t1 WHERE _id < 8;
813
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
814
SHOW TABLE STATUS LIKE 't1';
815
CHECK TABLE t1 EXTENDED;
816
REPAIR TABLE t1 QUICK;
817
CHECK TABLE t1 EXTENDED;
818
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
819
SHOW TABLE STATUS LIKE 't1';
823
SET @@myisam_repair_threads=1;
824
SHOW VARIABLES LIKE 'myisam_repair%';
827
# BUG#21310 - Trees in SQL causing a "crashed" table with MyISAM storage
831
# A simplified test case that reflect crashed table issue.
832
CREATE TABLE t1(a VARCHAR(16));
833
INSERT INTO t1 VALUES('aaaaaaaa'),(NULL);
834
UPDATE t1 AS ta1, t1 AS ta2 SET ta1.a='aaaaaaaaaaaaaaaa';
838
# A test case that reflect wrong result set.
839
CREATE TABLE t1(a INT);
840
INSERT INTO t1 VALUES(1),(2);
841
UPDATE t1,t1 AS t2 SET t1.a=t1.a+2 WHERE t1.a=t2.a-1;
842
SELECT * FROM t1 ORDER BY a;
642
846
# Bug#24607 - MyISAM pointer size determined incorrectly
644
CREATE TEMPORARY TABLE t1 (c1 TEXT) ENGINE=MyISAM;
645
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
646
show table status like 't1';
848
CREATE TABLE t1 (c1 TEXT) AVG_ROW_LENGTH=70100 MAX_ROWS=4100100100;
849
--replace_column 5 X 6 X 7 X 9 X 10 X 11 X 12 X 13 X 14 X 16 X
850
SHOW TABLE STATUS LIKE 't1';
650
854
# Bug#26231 - select count(*) on myisam table returns wrong value
651
855
# when index is used
653
CREATE TEMPORARY TABLE t1 (c1 TEXT NOT NULL, KEY c1 (c1(10))) ENGINE=MyISAM;
857
CREATE TABLE t1 (c1 TEXT NOT NULL, KEY c1 (c1(10))) ENGINE=MyISAM;
654
858
# Fill at least two key blocks. "Tab, A" must be in both blocks.
655
859
INSERT INTO t1 VALUES
656
860
(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
799
1003
let $default=`select @@storage_engine`;
800
1004
set storage_engine=MyISAM;
801
let $temp= TEMPORARY;
802
1005
source include/varchar.inc;
805
1008
# Some errors/warnings on create
808
--error ER_TOO_BIG_FIELDLENGTH
809
create temporary table t1 (v varchar(65530), key(v));
810
--error ER_TOO_BIG_FIELDLENGTH
811
create temporary table t1 (v varchar(65536));
812
--error ER_TOO_BIG_FIELDLENGTH
813
create temporary table t1 (v varchar(65530));
1011
create table t1 (v varchar(65530), key(v));
1012
drop table if exists t1;
1013
create table t1 (v varchar(65536));
1014
show create table t1;
1016
create table t1 (v varchar(65530) character set utf8);
1017
show create table t1;
815
1020
# MyISAM specific varchar tests
816
--error ER_TOO_BIG_FIELDLENGTH
817
create temporary table t1 (v varchar(65535));
1022
create table t1 (v varchar(65535));
819
1024
eval set storage_engine=$default;
1027
# Test concurrent insert
1028
# First with static record length
1030
set @save_concurrent_insert=@@concurrent_insert;
1031
set global concurrent_insert=1;
1032
create table t1 (a int);
1033
insert into t1 values (1),(2),(3),(4),(5);
1034
lock table t1 read local;
1035
connect (con1,localhost,root,,);
1037
# Insert in table without hole
1038
insert into t1 values(6),(7);
1041
delete from t1 where a>=3 and a<=4;
1042
lock table t1 read local;
1044
set global concurrent_insert=2;
1045
# Insert in table with hole -> Should insert at end
1046
insert into t1 values (8),(9);
1050
insert into t1 values (10),(11),(12);
1056
# Same test with dynamic record length
1057
create table t1 (a int, b varchar(30) default "hello");
1058
insert into t1 (a) values (1),(2),(3),(4),(5);
1059
lock table t1 read local;
1060
connect (con1,localhost,root,,);
1062
# Insert in table without hole
1063
insert into t1 (a) values(6),(7);
1066
delete from t1 where a>=3 and a<=4;
1067
lock table t1 read local;
1069
set global concurrent_insert=2;
1070
# Insert in table with hole -> Should insert at end
1071
insert into t1 (a) values (8),(9);
1075
insert into t1 (a) values (10),(11),(12);
1080
set global concurrent_insert=@save_concurrent_insert;
822
1083
# BUG#9622 - ANALYZE TABLE and ALTER TABLE .. ENABLE INDEX produce
823
1084
# different statistics on the same table with NULL values.
854
1126
# Bug#4692 - DISABLE/ENABLE KEYS waste a space
856
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';
1128
CREATE TABLE t1 (c1 INT, c2 INT, UNIQUE INDEX (c1), INDEX (c2)) ENGINE=MYISAM;
1129
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
1130
SHOW TABLE STATUS LIKE 't1';
859
1131
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';
1132
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
1133
SHOW TABLE STATUS LIKE 't1';
1134
ALTER TABLE t1 DISABLE KEYS;
1135
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
1136
SHOW TABLE STATUS LIKE 't1';
1137
ALTER TABLE t1 ENABLE KEYS;
1138
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
1139
SHOW TABLE STATUS LIKE 't1';
1140
ALTER TABLE t1 DISABLE KEYS;
1141
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
1142
SHOW TABLE STATUS LIKE 't1';
1143
ALTER TABLE t1 ENABLE KEYS;
1144
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
1145
SHOW TABLE STATUS LIKE 't1';
874
1146
#--exec ls -log var/master-data/test/t1.MYI
875
1147
#--exec myisamchk -dvv var/master-data/test/t1.MYI
876
1148
#--exec myisamchk -iev var/master-data/test/t1.MYI
877
1149
--echo # Enable keys with parallel repair
1150
SET @@myisam_repair_threads=2;
878
1151
ALTER TABLE t1 DISABLE KEYS;
879
1152
ALTER TABLE t1 ENABLE KEYS;
1153
SET @@myisam_repair_threads=1;
1154
CHECK TABLE t1 EXTENDED;
884
1158
# Bug#28837: MyISAM storage engine error (134) doing delete with self-join
886
# DRIZZLE NOTE: Cannot self join on temp tables.
887
CREATE TABLE t1 (id int NOT NULL, ref int NOT NULL, INDEX (id));
1161
CREATE TABLE t1 (id int NOT NULL, ref int NOT NULL, INDEX (id)) ENGINE=MyISAM;
888
1162
CREATE TABLE t2 LIKE t1;
890
1164
INSERT INTO t2 (id, ref) VALUES (1,3), (2,1), (3,2), (4,5), (4,4);