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
700
score INT NOT NULL DEFAULT 0,
558
704
insert into t1 (cip) VALUES (1), (2), (3);
559
705
insert into t1 (cip, bob) VALUES (4, 'a' ), (5, 'b'),
743
# BUG#18036 - update of table joined to self reports table as crashed
745
CREATE TABLE t1(a CHAR(9), b VARCHAR(7)) ENGINE=MyISAM;
746
INSERT INTO t1(a) VALUES('xxxxxxxxx'),('xxxxxxxxx');
747
UPDATE t1 AS ta1,t1 AS ta2 SET ta1.b='aaaaaa',ta2.b='bbbbbb';
597
752
# Bug#8283 - OPTIMIZE TABLE causes data loss
754
SET GLOBAL myisam_repair_threads=2;
755
SHOW VARIABLES LIKE 'myisam_repair%';
599
757
# 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';
759
`_id` int NOT NULL default '0',
763
`loverlap` int default NULL,
764
`roverlap` int default NULL,
765
`lneighbor_id` int default NULL,
766
`rneighbor_id` int default NULL,
767
`length_` int default NULL,
770
`_obj_class` text NOT NULL,
772
UNIQUE KEY `sequence_name_index` (`name`(50)),
776
INSERT INTO t1 VALUES
777
(1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample1',''),
778
(2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample2',''),
779
(3,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample3',''),
780
(4,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample4',''),
781
(5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample5',''),
782
(6,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample6',''),
783
(7,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample7',''),
784
(8,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample8',''),
785
(9,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample9','');
788
DELETE FROM t1 WHERE _id < 8;
789
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
790
SHOW TABLE STATUS LIKE 't1';
791
CHECK TABLE t1 EXTENDED;
793
CHECK TABLE t1 EXTENDED;
794
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
795
SHOW TABLE STATUS LIKE 't1';
799
# Test REPAIR QUICK. This retains the old data file.
801
`_id` int NOT NULL default '0',
805
`loverlap` int default NULL,
806
`roverlap` int default NULL,
807
`lneighbor_id` int default NULL,
808
`rneighbor_id` int default NULL,
809
`length_` int default NULL,
812
`_obj_class` text NOT NULL,
814
UNIQUE KEY `sequence_name_index` (`name`(50)),
818
INSERT INTO t1 VALUES
819
(1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample1',''),
820
(2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample2',''),
821
(3,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample3',''),
822
(4,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample4',''),
823
(5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample5',''),
824
(6,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample6',''),
825
(7,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample7',''),
826
(8,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample8',''),
827
(9,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample9','');
830
DELETE FROM t1 WHERE _id < 8;
831
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
832
SHOW TABLE STATUS LIKE 't1';
833
CHECK TABLE t1 EXTENDED;
834
REPAIR TABLE t1 QUICK;
835
CHECK TABLE t1 EXTENDED;
836
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
837
SHOW TABLE STATUS LIKE 't1';
841
SET GLOBAL myisam_repair_threads=1;
842
SHOW VARIABLES LIKE 'myisam_repair%';
845
# BUG#21310 - Trees in SQL causing a "crashed" table with MyISAM storage
849
# A simplified test case that reflect crashed table issue.
850
CREATE TABLE t1(a VARCHAR(16)) ENGINE=MyISAM;
851
INSERT INTO t1 VALUES('aaaaaaaa'),(NULL);
852
UPDATE t1 AS ta1, t1 AS ta2 SET ta1.a='aaaaaaaaaaaaaaaa';
856
# A test case that reflect wrong result set.
857
CREATE TABLE t1(a INT) ENGINE=MyISAM;
858
INSERT INTO t1 VALUES(1),(2);
859
UPDATE t1,t1 AS t2 SET t1.a=t1.a+2 WHERE t1.a=t2.a-1;
860
SELECT * FROM t1 ORDER BY a;
642
864
# 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';
866
CREATE TABLE t1 (c1 TEXT) ENGINE=MyISAM AVG_ROW_LENGTH=70100 MAX_ROWS=4100100100;
867
--replace_column 5 X 6 X 7 X 9 X 10 X 11 X 12 X 13 X 14 X 16 X
868
SHOW TABLE STATUS LIKE 't1';
650
872
# Bug#26231 - select count(*) on myisam table returns wrong value
651
873
# when index is used
653
CREATE TEMPORARY TABLE t1 (c1 TEXT NOT NULL, KEY c1 (c1(10))) ENGINE=MyISAM;
875
CREATE TABLE t1 (c1 TEXT NOT NULL, KEY c1 (c1(10))) ENGINE=MyISAM;
654
876
# Fill at least two key blocks. "Tab, A" must be in both blocks.
655
877
INSERT INTO t1 VALUES
656
878
(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
799
1021
let $default=`select @@storage_engine`;
800
1022
set storage_engine=MyISAM;
801
let $temp= TEMPORARY;
802
1023
source include/varchar.inc;
805
1026
# 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));
1030
create table t1 (v varchar(65530), key(v));
1032
create table t1 (v varchar(65536));
1034
create table t1 (v varchar(65530));
815
1036
# MyISAM specific varchar tests
816
--error ER_TOO_BIG_FIELDLENGTH
817
create temporary table t1 (v varchar(65535));
1038
create table t1 (v varchar(65535));
819
1040
eval set storage_engine=$default;
1043
# Test concurrent insert
1044
# First with static record length
1046
#@TODO The below test fails with unknown system variable
1049
#set @save_concurrent_insert=@@concurrent_insert;
1050
#set global concurrent_insert=1;
1051
#create table t1 (a int);
1052
#insert into t1 values (1),(2),(3),(4),(5);
1053
#lock table t1 read local;
1054
#connect (con1,localhost,root,,);
1056
# Insert in table without hole
1057
#insert into t1 values(6),(7);
1058
#connection default;
1060
#delete from t1 where a>=3 and a<=4;
1061
#lock table t1 read local;
1063
#set global concurrent_insert=2;
1064
# Insert in table with hole -> Should insert at end
1065
#insert into t1 values (8),(9);
1066
#connection default;
1069
#insert into t1 values (10),(11),(12);
1075
# Same test with dynamic record length
1076
#create table t1 (a int, b varchar(30) default "hello");
1077
#insert into t1 (a) values (1),(2),(3),(4),(5);
1078
#lock table t1 read local;
1079
#connect (con1,localhost,root,,);
1081
# Insert in table without hole
1082
#insert into t1 (a) values(6),(7);
1083
#connection default;
1085
#delete from t1 where a>=3 and a<=4;
1086
#lock table t1 read local;
1088
#set global concurrent_insert=2;
1089
## Insert in table with hole -> Should insert at end
1090
#insert into t1 (a) values (8),(9);
1091
#connection default;
1094
#insert into t1 (a) values (10),(11),(12);
1099
#set global concurrent_insert=@save_concurrent_insert;
822
1102
# BUG#9622 - ANALYZE TABLE and ALTER TABLE .. ENABLE INDEX produce
823
1103
# different statistics on the same table with NULL values.
824
create temporary table t1 (a int, key(a)) engine=myisam;
1104
create table t1 (a int, key(a));
826
1106
insert into t1 values (1),(2),(3),(4),(NULL),(NULL),(NULL),(NULL);
827
1107
analyze table t1;
854
1145
# 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';
1147
CREATE TABLE t1 (c1 INT, c2 INT, UNIQUE INDEX (c1), INDEX (c2)) ENGINE=MYISAM;
1148
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
1149
SHOW TABLE STATUS LIKE 't1';
859
1150
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';
1151
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
1152
SHOW TABLE STATUS LIKE 't1';
1153
ALTER TABLE t1 DISABLE KEYS;
1154
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
1155
SHOW TABLE STATUS LIKE 't1';
1156
ALTER TABLE t1 ENABLE KEYS;
1157
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
1158
SHOW TABLE STATUS LIKE 't1';
1159
ALTER TABLE t1 DISABLE KEYS;
1160
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
1161
SHOW TABLE STATUS LIKE 't1';
1162
ALTER TABLE t1 ENABLE KEYS;
1163
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
1164
SHOW TABLE STATUS LIKE 't1';
874
1165
#--exec ls -log var/master-data/test/t1.MYI
875
1166
#--exec myisamchk -dvv var/master-data/test/t1.MYI
876
1167
#--exec myisamchk -iev var/master-data/test/t1.MYI
877
1168
--echo # Enable keys with parallel repair
1169
SET GLOBAL myisam_repair_threads=2;
878
1170
ALTER TABLE t1 DISABLE KEYS;
879
1171
ALTER TABLE t1 ENABLE KEYS;
1172
SET GLOBAL myisam_repair_threads=1;
1173
CHECK TABLE t1 EXTENDED;
884
1177
# 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));
1180
CREATE TABLE t1 (id int NOT NULL, ref int NOT NULL, INDEX (id)) ENGINE=MyISAM;
888
1181
CREATE TABLE t2 LIKE t1;
890
1183
INSERT INTO t2 (id, ref) VALUES (1,3), (2,1), (3,2), (4,5), (4,4);