541
551
# 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;
553
create table t1 (c1 int, c2 varchar(4) not null default '',
545
555
insert into t1 values (1,'A'), (2, 'B'), (3, 'A');
546
556
update t1 set c2='A B' where c1=2;
562
# Bug#12296 - CHECKSUM TABLE reports 0 for the table
563
# This happened if the first record was marked as deleted.
565
create table t1 (c1 int);
566
insert into t1 values (1),(2),(3),(4);
568
delete from t1 where c1 = 1;
569
create table t2 as select * from t1;
570
# The following returns 0 with the bug in place.
572
# The above should give the same number as the following.
577
# BUG#12232: New myisam_stats_method variable.
579
# @TODO The following segfaults. Disabling for now - JRP
581
#show variables like 'myisam_stats_method';
583
#create table t1 (a int, key(a));
584
#insert into t1 values (0),(1),(2),(3),(4);
585
#insert into t1 select NULL from t1;
587
# default: NULLs considered inequal
590
#insert into t1 values (11);
591
#delete from t1 where a=11;
595
# Set nulls to be equal:
596
#set myisam_stats_method=nulls_equal;
597
#show variables like 'myisam_stats_method';
598
#insert into t1 values (11);
599
#delete from t1 where a=11;
604
#insert into t1 values (11);
605
#delete from t1 where a=11;
610
# Set nulls back to be equal
611
#set myisam_stats_method=DEFAULT;
612
#show variables like 'myisam_stats_method';
613
#insert into t1 values (11);
614
#delete from t1 where a=11;
619
#insert into t1 values (11);
620
#delete from t1 where a=11;
627
# WL#2609, CSC#XXXX: MyISAM
628
#set myisam_stats_method=nulls_ignored;
629
#show variables like 'myisam_stats_method';
632
# a char(3), b char(4), c char(5), d char(6),
635
#insert into t1 values ('bcd','def1', NULL, 'zz');
636
#insert into t1 values ('bcd','def2', NULL, 'zz');
637
#insert into t1 values ('bce','def1', 'yuu', NULL);
638
#insert into t1 values ('bce','def2', NULL, 'quux');
645
#set myisam_stats_method=DEFAULT;
550
648
# BUG#13814 - key value packed incorrectly for TINYBLOBs
552
create temporary table t1(
553
651
cip INT NOT NULL,
554
652
score INT NOT NULL DEFAULT 0,
558
656
insert into t1 (cip) VALUES (1), (2), (3);
559
657
insert into t1 (cip, bob) VALUES (4, 'a' ), (5, 'b'),
695
# BUG#18036 - update of table joined to self reports table as crashed
697
CREATE TABLE t1(a CHAR(9), b VARCHAR(7)) ENGINE=MyISAM;
698
INSERT INTO t1(a) VALUES('xxxxxxxxx'),('xxxxxxxxx');
699
UPDATE t1 AS ta1,t1 AS ta2 SET ta1.b='aaaaaa',ta2.b='bbbbbb';
597
704
# Bug#8283 - OPTIMIZE TABLE causes data loss
706
SET GLOBAL myisam_repair_threads=2;
707
SHOW VARIABLES LIKE 'myisam_repair%';
599
709
# 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';
711
`_id` int NOT NULL default '0',
715
`loverlap` int default NULL,
716
`roverlap` int default NULL,
717
`lneighbor_id` int default NULL,
718
`rneighbor_id` int default NULL,
719
`length_` int default NULL,
722
`_obj_class` text NOT NULL,
724
UNIQUE KEY `sequence_name_index` (`name`(50)),
728
INSERT INTO t1 VALUES
729
(1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample1',''),
730
(2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample2',''),
731
(3,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample3',''),
732
(4,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample4',''),
733
(5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample5',''),
734
(6,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample6',''),
735
(7,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample7',''),
736
(8,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample8',''),
737
(9,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample9','');
740
DELETE FROM t1 WHERE _id < 8;
741
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
742
SHOW TABLE STATUS LIKE 't1';
743
CHECK TABLE t1 EXTENDED;
745
CHECK TABLE t1 EXTENDED;
746
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
747
SHOW TABLE STATUS LIKE 't1';
751
# Test REPAIR QUICK. This retains the old data file.
753
`_id` int NOT NULL default '0',
757
`loverlap` int default NULL,
758
`roverlap` int default NULL,
759
`lneighbor_id` int default NULL,
760
`rneighbor_id` int default NULL,
761
`length_` int default NULL,
764
`_obj_class` text NOT NULL,
766
UNIQUE KEY `sequence_name_index` (`name`(50)),
770
INSERT INTO t1 VALUES
771
(1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample1',''),
772
(2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample2',''),
773
(3,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample3',''),
774
(4,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample4',''),
775
(5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample5',''),
776
(6,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample6',''),
777
(7,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample7',''),
778
(8,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample8',''),
779
(9,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample9','');
782
DELETE FROM t1 WHERE _id < 8;
783
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
784
SHOW TABLE STATUS LIKE 't1';
785
CHECK TABLE t1 EXTENDED;
786
REPAIR TABLE t1 QUICK;
787
CHECK TABLE t1 EXTENDED;
788
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
789
SHOW TABLE STATUS LIKE 't1';
793
SET GLOBAL myisam_repair_threads=1;
794
SHOW VARIABLES LIKE 'myisam_repair%';
797
# BUG#21310 - Trees in SQL causing a "crashed" table with MyISAM storage
801
# A simplified test case that reflect crashed table issue.
802
CREATE TABLE t1(a VARCHAR(16)) ENGINE=MyISAM;
803
INSERT INTO t1 VALUES('aaaaaaaa'),(NULL);
804
UPDATE t1 AS ta1, t1 AS ta2 SET ta1.a='aaaaaaaaaaaaaaaa';
808
# A test case that reflect wrong result set.
809
CREATE TABLE t1(a INT) ENGINE=MyISAM;
810
INSERT INTO t1 VALUES(1),(2);
811
UPDATE t1,t1 AS t2 SET t1.a=t1.a+2 WHERE t1.a=t2.a-1;
812
SELECT * FROM t1 ORDER BY a;
642
816
# 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';
818
CREATE TABLE t1 (c1 TEXT) ENGINE=MyISAM AVG_ROW_LENGTH=70100 MAX_ROWS=4100100100;
819
--replace_column 5 X 6 X 7 X 9 X 10 X 11 X 12 X 13 X 14 X 16 X
820
SHOW TABLE STATUS LIKE 't1';
650
824
# Bug#26231 - select count(*) on myisam table returns wrong value
651
825
# when index is used
653
CREATE TEMPORARY TABLE t1 (c1 TEXT NOT NULL, KEY c1 (c1(10))) ENGINE=MyISAM;
827
CREATE TABLE t1 (c1 TEXT NOT NULL, KEY c1 (c1(10))) ENGINE=MyISAM;
654
828
# Fill at least two key blocks. "Tab, A" must be in both blocks.
655
829
INSERT INTO t1 VALUES
656
830
(CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
854
1038
# 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';
1040
CREATE TABLE t1 (c1 INT, c2 INT, UNIQUE INDEX (c1), INDEX (c2)) ENGINE=MYISAM;
1041
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
1042
SHOW TABLE STATUS LIKE 't1';
859
1043
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';
1044
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
1045
SHOW TABLE STATUS LIKE 't1';
1046
ALTER TABLE t1 DISABLE KEYS;
1047
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
1048
SHOW TABLE STATUS LIKE 't1';
1049
ALTER TABLE t1 ENABLE KEYS;
1050
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
1051
SHOW TABLE STATUS LIKE 't1';
1052
ALTER TABLE t1 DISABLE KEYS;
1053
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
1054
SHOW TABLE STATUS LIKE 't1';
1055
ALTER TABLE t1 ENABLE KEYS;
1056
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
1057
SHOW TABLE STATUS LIKE 't1';
874
1058
#--exec ls -log var/master-data/test/t1.MYI
875
1059
#--exec myisamchk -dvv var/master-data/test/t1.MYI
876
1060
#--exec myisamchk -iev var/master-data/test/t1.MYI
877
1061
--echo # Enable keys with parallel repair
1062
SET GLOBAL myisam_repair_threads=2;
878
1063
ALTER TABLE t1 DISABLE KEYS;
879
1064
ALTER TABLE t1 ENABLE KEYS;
1065
SET GLOBAL myisam_repair_threads=1;
1066
CHECK TABLE t1 EXTENDED;
884
1070
# 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));
1073
CREATE TABLE t1 (id int NOT NULL, ref int NOT NULL, INDEX (id)) ENGINE=MyISAM;
888
1074
CREATE TABLE t2 LIKE t1;
890
1076
INSERT INTO t2 (id, ref) VALUES (1,3), (2,1), (3,2), (4,5), (4,4);