492
510
select c1 from t1 order by c1 limit 1;
514
# Bug #14400 Join could miss concurrently inserted row
516
# @TODO The below test hangs drizzle. Commenting out for now so I can continue with this test. - JRP
519
#create table t1 (a int not null, primary key(a));
520
#create table t2 (a int not null, b int not null, primary key(a,b));
521
#insert into t1 values (1),(2),(3),(4),(5),(6);
522
#insert into t2 values (1,1),(2,1);
523
#lock tables t1 read local, t2 read local;
524
#select straight_join * from t1,t2 force index (primary) where t1.a=t2.a;
525
#connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
526
#insert into t2 values(2,0);
529
#select straight_join * from t1,t2 force index (primary) where t1.a=t2.a;
534
#CREATE TABLE t1 (c1 varchar(250) NOT NULL);
535
#CREATE TABLE t2 (c1 varchar(250) NOT NULL, PRIMARY KEY (c1));
536
#INSERT INTO t1 VALUES ('test000001'), ('test000002'), ('test000003');
537
#INSERT INTO t2 VALUES ('test000002'), ('test000003'), ('test000004');
538
#LOCK TABLES t1 READ LOCAL, t2 READ LOCAL;
539
#SELECT t1.c1 AS t1c1, t2.c1 AS t2c1 FROM t1, t2
540
# WHERE t1.c1 = t2.c1 HAVING t1c1 != t2c1;
541
#connect (con1,localhost,root,,);
543
#INSERT INTO t2 VALUES ('test000001'), ('test000005');
546
#SELECT t1.c1 AS t1c1, t2.c1 AS t2c1 FROM t1, t2
547
# WHERE t1.c1 = t2.c1 HAVING t1c1 != t2c1;
495
551
# 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;
553
create table t1 (a int, b varchar(200), c text not null) checksum=1;
554
create table t2 (a int, b varchar(200), c text not null) checksum=0;
499
555
insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
500
556
insert t2 select * from t1;
501
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
557
checksum table t1, t2, t3 quick;
558
checksum table t1, t2, t3;
559
checksum table t1, t2, t3 extended;
503
561
drop table t1,t2;
505
563
#@TODO Figure out what the heck the below is testing.
541
599
# 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;
601
create table t1 (c1 int, c2 varchar(4) not null default '',
545
603
insert into t1 values (1,'A'), (2, 'B'), (3, 'A');
546
604
update t1 set c2='A B' where c1=2;
610
# Bug#12296 - CHECKSUM TABLE reports 0 for the table
611
# This happened if the first record was marked as deleted.
613
create table t1 (c1 int);
614
insert into t1 values (1),(2),(3),(4);
616
delete from t1 where c1 = 1;
617
create table t2 as select * from t1;
618
# The following returns 0 with the bug in place.
620
# The above should give the same number as the following.
625
# BUG#12232: New myisam_stats_method variable.
627
# @TODO The following segfaults. Disabling for now - JRP
629
#show variables like 'myisam_stats_method';
631
#create table t1 (a int, key(a));
632
#insert into t1 values (0),(1),(2),(3),(4);
633
#insert into t1 select NULL from t1;
635
# default: NULLs considered inequal
638
#insert into t1 values (11);
639
#delete from t1 where a=11;
643
# Set nulls to be equal:
644
#set myisam_stats_method=nulls_equal;
645
#show variables like 'myisam_stats_method';
646
#insert into t1 values (11);
647
#delete from t1 where a=11;
652
#insert into t1 values (11);
653
#delete from t1 where a=11;
658
# Set nulls back to be equal
659
#set myisam_stats_method=DEFAULT;
660
#show variables like 'myisam_stats_method';
661
#insert into t1 values (11);
662
#delete from t1 where a=11;
667
#insert into t1 values (11);
668
#delete from t1 where a=11;
675
# WL#2609, CSC#XXXX: MyISAM
676
#set myisam_stats_method=nulls_ignored;
677
#show variables like 'myisam_stats_method';
680
# a char(3), b char(4), c char(5), d char(6),
683
#insert into t1 values ('bcd','def1', NULL, 'zz');
684
#insert into t1 values ('bcd','def2', NULL, 'zz');
685
#insert into t1 values ('bce','def1', 'yuu', NULL);
686
#insert into t1 values ('bce','def2', NULL, 'quux');
693
#set myisam_stats_method=DEFAULT;
550
696
# BUG#13814 - key value packed incorrectly for TINYBLOBs
552
create temporary table t1(
553
699
cip INT NOT NULL,
554
701
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'),
705
insert into t1 (cip, time) VALUES (1, '00:01'), (2, '00:02'), (3,'00:03');
706
insert into t1 (cip, bob, time) VALUES (4, 'a', '00:04'), (5, 'b', '00:05'),
561
708
select * from t1 where bob is null and cip=1;
562
create index bug on t1 (bob(22), cip);
709
create index bug on t1 (bob(22), cip, time);
563
710
select * from t1 where bob is null and cip=1;
567
714
# Bug#14980 - COUNT(*) incorrect on MyISAM table with certain INDEX
569
create temporary table t1 (
570
717
id1 int not null auto_increment,
571
718
id2 int not null default '0',
744
# BUG#18036 - update of table joined to self reports table as crashed
746
CREATE TABLE t1(a CHAR(9), b VARCHAR(7)) ENGINE=MyISAM;
747
INSERT INTO t1(a) VALUES('xxxxxxxxx'),('xxxxxxxxx');
748
UPDATE t1 AS ta1,t1 AS ta2 SET ta1.b='aaaaaa',ta2.b='bbbbbb';
597
753
# Bug#8283 - OPTIMIZE TABLE causes data loss
755
SET GLOBAL myisam_repair_threads=2;
756
SHOW VARIABLES LIKE 'myisam_repair%';
599
758
# 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';
760
`_id` int NOT NULL default '0',
764
`loverlap` int default NULL,
765
`roverlap` int default NULL,
766
`lneighbor_id` int default NULL,
767
`rneighbor_id` int default NULL,
768
`length_` int default NULL,
771
`_obj_class` text NOT NULL,
773
UNIQUE KEY `sequence_name_index` (`name`(50)),
777
INSERT INTO t1 VALUES
778
(1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample1',''),
779
(2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample2',''),
780
(3,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample3',''),
781
(4,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample4',''),
782
(5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample5',''),
783
(6,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample6',''),
784
(7,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample7',''),
785
(8,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample8',''),
786
(9,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample9','');
789
DELETE FROM t1 WHERE _id < 8;
790
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
791
SHOW TABLE STATUS LIKE 't1';
792
CHECK TABLE t1 EXTENDED;
794
CHECK TABLE t1 EXTENDED;
795
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
796
SHOW TABLE STATUS LIKE 't1';
800
# Test REPAIR QUICK. This retains the old data file.
802
`_id` int NOT NULL default '0',
806
`loverlap` int default NULL,
807
`roverlap` int default NULL,
808
`lneighbor_id` int default NULL,
809
`rneighbor_id` int default NULL,
810
`length_` int default NULL,
813
`_obj_class` text NOT NULL,
815
UNIQUE KEY `sequence_name_index` (`name`(50)),
819
INSERT INTO t1 VALUES
820
(1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample1',''),
821
(2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample2',''),
822
(3,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample3',''),
823
(4,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample4',''),
824
(5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample5',''),
825
(6,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample6',''),
826
(7,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample7',''),
827
(8,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample8',''),
828
(9,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample9','');
831
DELETE FROM t1 WHERE _id < 8;
832
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
833
SHOW TABLE STATUS LIKE 't1';
834
CHECK TABLE t1 EXTENDED;
835
REPAIR TABLE t1 QUICK;
836
CHECK TABLE t1 EXTENDED;
837
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
838
SHOW TABLE STATUS LIKE 't1';
842
SET GLOBAL myisam_repair_threads=1;
843
SHOW VARIABLES LIKE 'myisam_repair%';
846
# BUG#21310 - Trees in SQL causing a "crashed" table with MyISAM storage
850
# A simplified test case that reflect crashed table issue.
851
CREATE TABLE t1(a VARCHAR(16)) ENGINE=MyISAM;
852
INSERT INTO t1 VALUES('aaaaaaaa'),(NULL);
853
UPDATE t1 AS ta1, t1 AS ta2 SET ta1.a='aaaaaaaaaaaaaaaa';
857
# A test case that reflect wrong result set.
858
CREATE TABLE t1(a INT) ENGINE=MyISAM;
859
INSERT INTO t1 VALUES(1),(2);
860
UPDATE t1,t1 AS t2 SET t1.a=t1.a+2 WHERE t1.a=t2.a-1;
861
SELECT * FROM t1 ORDER BY a;
642
865
# 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';
867
CREATE TABLE t1 (c1 TEXT) ENGINE=MyISAM AVG_ROW_LENGTH=70100 MAX_ROWS=4100100100;
868
--replace_column 5 X 6 X 7 X 9 X 10 X 11 X 12 X 13 X 14 X 16 X
869
SHOW TABLE STATUS LIKE 't1';
650
873
# Bug#26231 - select count(*) on myisam table returns wrong value
651
874
# when index is used
653
CREATE TEMPORARY TABLE t1 (c1 TEXT NOT NULL, KEY c1 (c1(10))) ENGINE=MyISAM;
876
CREATE TABLE t1 (c1 TEXT NOT NULL, KEY c1 (c1(10))) ENGINE=MyISAM;
654
877
# Fill at least two key blocks. "Tab, A" must be in both blocks.
655
878
INSERT INTO t1 VALUES
656
879
(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
799
1022
let $default=`select @@storage_engine`;
800
1023
set storage_engine=MyISAM;
801
let $temp= TEMPORARY;
802
1024
source include/varchar.inc;
805
1027
# 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));
1031
create table t1 (v varchar(65530), key(v));
1033
create table t1 (v varchar(65536));
1035
create table t1 (v varchar(65530));
815
1037
# MyISAM specific varchar tests
816
--error ER_TOO_BIG_FIELDLENGTH
817
create temporary table t1 (v varchar(65535));
1039
create table t1 (v varchar(65535));
819
1041
eval set storage_engine=$default;
1044
# Test concurrent insert
1045
# First with static record length
1047
#@TODO The below test fails with unknown system variable
1050
#set @save_concurrent_insert=@@concurrent_insert;
1051
#set global concurrent_insert=1;
1052
#create table t1 (a int);
1053
#insert into t1 values (1),(2),(3),(4),(5);
1054
#lock table t1 read local;
1055
#connect (con1,localhost,root,,);
1057
# Insert in table without hole
1058
#insert into t1 values(6),(7);
1059
#connection default;
1061
#delete from t1 where a>=3 and a<=4;
1062
#lock table t1 read local;
1064
#set global concurrent_insert=2;
1065
# Insert in table with hole -> Should insert at end
1066
#insert into t1 values (8),(9);
1067
#connection default;
1070
#insert into t1 values (10),(11),(12);
1076
# Same test with dynamic record length
1077
#create table t1 (a int, b varchar(30) default "hello");
1078
#insert into t1 (a) values (1),(2),(3),(4),(5);
1079
#lock table t1 read local;
1080
#connect (con1,localhost,root,,);
1082
# Insert in table without hole
1083
#insert into t1 (a) values(6),(7);
1084
#connection default;
1086
#delete from t1 where a>=3 and a<=4;
1087
#lock table t1 read local;
1089
#set global concurrent_insert=2;
1090
## Insert in table with hole -> Should insert at end
1091
#insert into t1 (a) values (8),(9);
1092
#connection default;
1095
#insert into t1 (a) values (10),(11),(12);
1100
#set global concurrent_insert=@save_concurrent_insert;
822
1103
# BUG#9622 - ANALYZE TABLE and ALTER TABLE .. ENABLE INDEX produce
823
1104
# different statistics on the same table with NULL values.
824
create temporary table t1 (a int, key(a)) engine=myisam;
1105
create table t1 (a int, key(a));
826
1107
insert into t1 values (1),(2),(3),(4),(NULL),(NULL),(NULL),(NULL);
827
1108
analyze table t1;
854
1146
# 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';
1148
CREATE TABLE t1 (c1 INT, c2 INT, UNIQUE INDEX (c1), INDEX (c2)) ENGINE=MYISAM;
1149
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
1150
SHOW TABLE STATUS LIKE 't1';
859
1151
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';
1152
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
1153
SHOW TABLE STATUS LIKE 't1';
1154
ALTER TABLE t1 DISABLE KEYS;
1155
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
1156
SHOW TABLE STATUS LIKE 't1';
1157
ALTER TABLE t1 ENABLE KEYS;
1158
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
1159
SHOW TABLE STATUS LIKE 't1';
1160
ALTER TABLE t1 DISABLE KEYS;
1161
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
1162
SHOW TABLE STATUS LIKE 't1';
1163
ALTER TABLE t1 ENABLE KEYS;
1164
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
1165
SHOW TABLE STATUS LIKE 't1';
874
1166
#--exec ls -log var/master-data/test/t1.MYI
875
1167
#--exec myisamchk -dvv var/master-data/test/t1.MYI
876
1168
#--exec myisamchk -iev var/master-data/test/t1.MYI
877
1169
--echo # Enable keys with parallel repair
1170
SET GLOBAL myisam_repair_threads=2;
878
1171
ALTER TABLE t1 DISABLE KEYS;
879
1172
ALTER TABLE t1 ENABLE KEYS;
1173
SET GLOBAL myisam_repair_threads=1;
1174
CHECK TABLE t1 EXTENDED;
884
1178
# 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));
1181
CREATE TABLE t1 (id int NOT NULL, ref int NOT NULL, INDEX (id)) ENGINE=MyISAM;
888
1182
CREATE TABLE t2 LIKE t1;
890
1184
INSERT INTO t2 (id, ref) VALUES (1,3), (2,1), (3,2), (4,5), (4,4);