~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/myisam.test

  • Committer: devananda
  • Date: 2009-07-01 17:38:47 UTC
  • mto: (1093.1.7 captain)
  • mto: This revision was merged to the branch mainline in revision 1095.
  • Revision ID: devananda.vdv@gmail.com-20090701173847-3n3mbtessg5ff35e
refactored function/benchmark into plugin/benchmark

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
# Test problem with CHECK TABLE;
13
13
#
14
14
 
15
 
CREATE TEMPORARY TABLE t1 (
 
15
CREATE TABLE t1 (
16
16
  STRING_DATA char(255) default NULL,
17
17
  KEY string_data (STRING_DATA)
18
18
) ENGINE=MyISAM;
30
30
# Test problem with rows that are 65517-65520 bytes long
31
31
#
32
32
 
33
 
create temporary table t1 (a int not null auto_increment, b blob not null, primary key (a)) engine=myisam;
 
33
create table t1 (a int not null auto_increment, b blob not null, primary key (a));
34
34
 
35
35
let $1=100;
36
36
disable_query_log;
60
60
# Test bug: Two optimize in a row reset index cardinality
61
61
#
62
62
 
63
 
create TEMPORARY table t1 (a int not null auto_increment, b int not null, primary key (a), index(b)) ENGINE=MYISAM;
 
63
create table t1 (a int not null auto_increment, b int not null, primary key (a), index(b));
64
64
insert into t1 (b) values (1),(2),(2),(2),(2);
65
 
alter table t1 engine=MYISAM;
 
65
optimize table t1;
66
66
show index from t1;
67
 
alter table t1 engine=MyISAM;
 
67
optimize table t1;
68
68
show index from t1;
69
69
drop table t1;
70
70
 
72
72
# Test of how ORDER BY works when doing it on the whole table
73
73
#
74
74
 
75
 
create temporary table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=myisam;
 
75
create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=myisam;
76
76
insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
77
77
explain select * from t1 order by a;
78
78
explain select * from t1 order by b;
89
89
# in ha_myisam::repair, and index size is changed (decreased).
90
90
#
91
91
 
92
 
create temporary table t1 ( t1 char(255), key(t1(250))) ENGINE=MYISAM;
 
92
create table t1 ( t1 char(255), key(t1(250)));
93
93
insert t1 values ('137513751375137513751375137513751375137569516951695169516951695169516951695169');
94
94
insert t1 values ('178417841784178417841784178417841784178403420342034203420342034203420342034203');
95
95
insert t1 values ('213872387238723872387238723872387238723867376737673767376737673767376737673767');
119
119
insert t1 values ('70'), ('84'), ('60'), ('20'), ('76'), ('89'), ('49'), ('50'),
120
120
('88'), ('61'), ('42'), ('98'), ('39'), ('30'), ('25'), ('66'), ('61'), ('48'),
121
121
('80'), ('84'), ('98'), ('19'), ('91'), ('42'), ('47');
122
 
alter table t1 ENGINE=myisam;
 
122
optimize table t1;
123
123
check table t1;
124
124
drop table t1;
125
125
 
127
127
# test of myisam with huge number of packed fields
128
128
#
129
129
 
130
 
create temporary table t1 (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8
 
130
create table t1 (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8
131
131
int, i9 int, i10 int, i11 int, i12 int, i13 int, i14 int, i15 int, i16 int, i17
132
132
int, i18 int, i19 int, i20 int, i21 int, i22 int, i23 int, i24 int, i25 int,
133
133
i26 int, i27 int, i28 int, i29 int, i30 int, i31 int, i32 int, i33 int, i34
302
302
#
303
303
# Test of REPAIR that once failed
304
304
#
305
 
CREATE TEMPORARY TABLE `t1` (
 
305
CREATE TABLE `t1` (
306
306
  `post_id` int NOT NULL auto_increment,
307
307
  `topic_id` int NOT NULL default '0',
308
308
  `post_time` datetime,
329
329
# Test of creating table with too long key
330
330
#
331
331
 
332
 
--error ER_TOO_LONG_KEY
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
 
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
 
332
--error 1071
 
333
CREATE 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
CREATE TABLE t1 (a varchar(300), b varchar(300), c varchar(300), d varchar(300), e varchar(300)) ENGINE=MyISAM;
 
335
--error 1071
336
336
ALTER TABLE t1 ADD INDEX t1 (a, b, c, d, e);
337
337
DROP TABLE t1;
338
338
 
340
340
# Test of cardinality of keys with NULL
341
341
#
342
342
 
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;
 
343
CREATE 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
 
alter table t1 ENGINE=MYISAM;
 
347
optimize table t1;
348
348
show index from t1;
349
349
explain select * from t1,t2 where t1.a=t2.a;
350
350
explain select * from t1,t2 force index(a) where t1.a=t2.a;
361
361
# Test bug when updating a split dynamic row where keys are not changed
362
362
#
363
363
 
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;
367
367
 
406
406
#
407
407
# two bugs in myisam-space-stripping feature
408
408
#
409
 
create temporary table t1 ( a text not null, key a (a(20))) engine=myisam;
 
409
create table t1 ( a text not null, key a (a(20)));
410
410
insert into t1 values ('aaa   '),('aaa'),('aa');
411
411
check table t1;
412
412
select concat(a,'.') from t1 where a='aaa';
419
419
# Third bug in the same code (BUG#2295)
420
420
#
421
421
 
422
 
create temporary table t1(a text not null, b text not null, c text not null, index (a(10),b(10),c(10))) engine=myisam;
 
422
create table t1(a text not null, b text not null, c text not null, index (a(10),b(10),c(10)));
423
423
insert into t1 values('807780', '477', '165');
424
424
insert into t1 values('807780', '477', '162');
425
425
insert into t1 values('807780', '472', '162');
430
430
# space-stripping in _mi_prefix_search: BUG#5284
431
431
#
432
432
DROP TABLE IF EXISTS t1;
433
 
CREATE TEMPORARY TABLE t1 (a varchar(150) NOT NULL, KEY (a)) ENGINE=MyISAM; 
 
433
CREATE TABLE t1 (a varchar(150) NOT NULL, KEY (a)) ENGINE=MyISAM; 
434
434
INSERT t1 VALUES ("can \tcan"); 
435
435
INSERT t1 VALUES ("can   can"); 
436
436
INSERT t1 VALUES ("can"); 
441
441
#
442
442
# Verify blob handling
443
443
#
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 ';
453
453
#
454
454
# Test text and unique
455
455
#
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;
469
469
#
470
470
# Test keys with 0 segments. (Bug #3203)
471
471
#
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;
483
483
#
484
484
# Bug#14616 - Freshly imported table returns error 124 when using LIMIT
485
485
#
486
 
create temporary table t1 (
 
486
create table t1 (
487
487
  c1 varchar(32),
488
488
  key (c1)
489
489
) engine=myisam;
494
494
 
495
495
# End of 4.0 tests
496
496
 
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) checksum=1;
 
498
create table t2 (a int, b varchar(200), c text not null) checksum=0;
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 #
502
 
show table status;
 
501
checksum table t1, t2, t3 quick;
 
502
checksum table t1, t2, t3;
 
503
checksum table t1, t2, t3 extended;
 
504
#show table status;
503
505
drop table t1,t2;
504
506
 
505
507
#@TODO Figure out what the heck the below is testing.
523
525
#show keys from t1;
524
526
#alter table t1 enable keys;
525
527
#show keys from t1;
526
 
#alter table t1 engine=MEMORY;
 
528
#alter table t1 engine=heap;
527
529
#alter table t1 disable keys;
528
530
#show keys from t1;
529
531
#drop table t1,t2;
531
533
#
532
534
# index search for NULL in blob. Bug #4816
533
535
#
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;
540
542
#
541
543
# bug9188 - Corruption Can't open file: 'table.MYI' (errno: 145)
542
544
#
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 '',
 
546
                 key(c2(3)));
545
547
insert into t1 values (1,'A'), (2, 'B'), (3, 'A');
546
548
update t1 set c2='A  B' where c1=2;
547
549
check table t1;
548
550
drop table t1;
549
551
 
 
552
 
 
553
#
 
554
# Bug#12296 - CHECKSUM TABLE reports 0 for the table
 
555
# This happened if the first record was marked as deleted.
 
556
#
 
557
create table t1 (c1 int);
 
558
insert into t1 values (1),(2),(3),(4);
 
559
checksum table t1;
 
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.
 
563
checksum table t1;
 
564
# The above should give the same number as the following.
 
565
checksum table t2;
 
566
drop table t1, t2;
 
567
 
 
568
#
 
569
# BUG#12232: New myisam_stats_method variable.
 
570
#
 
571
# @TODO The following segfaults. Disabling for now - JRP
 
572
#
 
573
#show variables like 'myisam_stats_method';
 
574
#
 
575
#create table t1 (a int, key(a));
 
576
#insert into t1 values (0),(1),(2),(3),(4);
 
577
#insert into t1 select NULL from t1;
 
578
 
 
579
# default: NULLs considered inequal
 
580
#analyze table t1; 
 
581
#show index from t1;
 
582
#insert into t1 values (11);
 
583
#delete from t1 where a=11;
 
584
#check table t1;
 
585
#show index from t1;
 
586
 
 
587
# Set nulls to be equal:
 
588
#set myisam_stats_method=nulls_equal;
 
589
#show variables like 'myisam_stats_method';
 
590
#insert into t1 values (11);
 
591
#delete from t1 where a=11;
 
592
 
 
593
#analyze table t1; 
 
594
#show index from t1;
 
595
#
 
596
#insert into t1 values (11);
 
597
#delete from t1 where a=11;
 
598
#
 
599
#check table t1;
 
600
#show index from t1;
 
601
#
 
602
# Set nulls back to be equal 
 
603
#set myisam_stats_method=DEFAULT;
 
604
#show variables like 'myisam_stats_method';
 
605
#insert into t1 values (11);
 
606
#delete from t1 where a=11;
 
607
#
 
608
#analyze table t1; 
 
609
#show index from t1;
 
610
#
 
611
#insert into t1 values (11);
 
612
#delete from t1 where a=11;
 
613
#
 
614
#check table t1;
 
615
#show index from t1;
 
616
#
 
617
#drop table t1;
 
618
 
 
619
# WL#2609, CSC#XXXX: MyISAM 
 
620
#set myisam_stats_method=nulls_ignored;
 
621
#show variables like 'myisam_stats_method';
 
622
#
 
623
#create table t1 (
 
624
#  a char(3), b char(4), c char(5), d char(6),
 
625
#  key(a,b,c,d)
 
626
#);
 
627
#insert into t1 values ('bcd','def1', NULL, 'zz');
 
628
#insert into t1 values ('bcd','def2', NULL, 'zz');
 
629
#insert into t1 values ('bce','def1', 'yuu', NULL);
 
630
#insert into t1 values ('bce','def2', NULL, 'quux');
 
631
#analyze table t1;
 
632
#show index from t1;
 
633
#delete from t1;
 
634
#analyze table t1;
 
635
#show index from t1;
 
636
#
 
637
#set myisam_stats_method=DEFAULT;
 
638
#drop table t1;
 
639
 
550
640
# BUG#13814 - key value packed incorrectly for TINYBLOBs
551
641
 
552
 
create temporary table t1(
 
642
create table t1(
553
643
  cip INT NOT NULL,
554
644
  score INT NOT NULL DEFAULT 0,
555
645
  bob TINYBLOB
556
 
) engine=myisam;
 
646
);
557
647
 
558
648
insert into t1 (cip) VALUES (1), (2), (3);
559
649
insert into t1 (cip, bob) VALUES (4, 'a' ), (5, 'b'), 
566
656
#
567
657
# Bug#14980 - COUNT(*) incorrect on MyISAM table with certain INDEX
568
658
#
569
 
create temporary table t1 (
 
659
create table t1 (
570
660
  id1 int not null auto_increment,
571
661
  id2 int not null default '0',
572
662
  t text not null,
585
675
# BUG##20357 - Got error 124 from storage engine using MIN and MAX functions
586
676
#              in queries
587
677
#
588
 
CREATE TEMPORARY TABLE t1(a int, KEY(a)) ENGINE=MyISAM;
 
678
CREATE TABLE t1(a int, KEY(a)) ENGINE=MyISAM;
589
679
INSERT INTO t1 VALUES(1);
590
680
SELECT MAX(a) FROM t1 IGNORE INDEX(a);
591
681
ALTER TABLE t1 DISABLE KEYS;
594
684
DROP TABLE t1;
595
685
 
596
686
#
 
687
# BUG#18036 - update of table joined to self reports table as crashed
 
688
#
 
689
CREATE TABLE t1(a CHAR(9), b VARCHAR(7)) ENGINE=MyISAM;
 
690
INSERT INTO t1(a) VALUES('xxxxxxxxx'),('xxxxxxxxx');
 
691
UPDATE t1 AS ta1,t1 AS ta2 SET ta1.b='aaaaaa',ta2.b='bbbbbb';
 
692
SELECT * FROM t1;
 
693
DROP TABLE t1;
 
694
 
 
695
#
597
696
# Bug#8283 - OPTIMIZE TABLE causes data loss
598
697
#
 
698
SET GLOBAL myisam_repair_threads=2;
 
699
SHOW VARIABLES LIKE 'myisam_repair%';
 
700
#
599
701
# Test OPTIMIZE. This creates a new data file.
600
 
CREATE TEMPORARY TABLE t1 (
 
702
CREATE TABLE t1 (
601
703
  `_id` int NOT NULL default '0',
602
704
  `url` text,
603
705
  `email` text,
628
730
#
629
731
SELECT _id FROM t1;
630
732
DELETE FROM t1 WHERE _id < 8;
631
 
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
632
 
show table status LIKE 't1';
633
 
CHECK TABLE t1;
634
 
ALTER TABLE t1 ENGINE=MYISAM;
635
 
CHECK TABLE t1;
636
 
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
637
 
show table status LIKE 't1';
 
733
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
 
734
SHOW TABLE STATUS LIKE 't1';
 
735
CHECK TABLE t1 EXTENDED;
 
736
OPTIMIZE TABLE t1;
 
737
CHECK TABLE t1 EXTENDED;
 
738
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
 
739
SHOW TABLE STATUS LIKE 't1';
638
740
SELECT _id FROM t1;
639
741
DROP TABLE t1;
 
742
#
 
743
SET GLOBAL myisam_repair_threads=1;
 
744
SHOW VARIABLES LIKE 'myisam_repair%';
 
745
 
 
746
#
 
747
# BUG#21310 - Trees in SQL causing a "crashed" table with MyISAM storage
 
748
#             engine
 
749
#
 
750
 
 
751
# A simplified test case that reflect crashed table issue.
 
752
CREATE TABLE t1(a VARCHAR(16)) ENGINE=MyISAM;
 
753
INSERT INTO t1 VALUES('aaaaaaaa'),(NULL);
 
754
UPDATE t1 AS ta1, t1 AS ta2 SET ta1.a='aaaaaaaaaaaaaaaa';
 
755
SELECT * FROM t1;
 
756
DROP TABLE t1;
 
757
 
 
758
# A test case that reflect wrong result set.
 
759
CREATE TABLE t1(a INT) ENGINE=MyISAM;
 
760
INSERT INTO t1 VALUES(1),(2);
 
761
UPDATE t1,t1 AS t2 SET t1.a=t1.a+2 WHERE t1.a=t2.a-1;
 
762
SELECT * FROM t1 ORDER BY a;
 
763
DROP TABLE t1;
640
764
 
641
765
#
642
766
# Bug#24607 - MyISAM pointer size determined incorrectly
643
767
#
644
 
CREATE TEMPORARY TABLE t1 (c1 TEXT) ENGINE=MyISAM;
645
 
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
646
 
show table status like 't1';
 
768
CREATE TABLE t1 (c1 TEXT) ENGINE=MyISAM AVG_ROW_LENGTH=70100 MAX_ROWS=4100100100;
 
769
--replace_column 5 X 6 X 7 X 9 X 10 X 11 X 12 X 13 X 14 X 16 X
 
770
SHOW TABLE STATUS LIKE 't1';
647
771
DROP TABLE t1;
648
772
 
649
773
#
650
774
# Bug#26231 - select count(*) on myisam table returns wrong value
651
775
#             when index is used
652
776
#
653
 
CREATE TEMPORARY TABLE t1 (c1 TEXT NOT NULL, KEY c1 (c1(10))) ENGINE=MyISAM;
 
777
CREATE TABLE t1 (c1 TEXT NOT NULL, KEY c1 (c1(10))) ENGINE=MyISAM;
654
778
# Fill at least two key blocks. "Tab, A" must be in both blocks. 
655
779
INSERT INTO t1 VALUES
656
780
  (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
798
922
 
799
923
let $default=`select @@storage_engine`;
800
924
set storage_engine=MyISAM;
801
 
let $temp= TEMPORARY;
802
925
source include/varchar.inc;
803
926
 
804
927
#
805
928
# Some errors/warnings on create
806
929
#
807
930
 
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));
 
931
--error 1074
 
932
create table t1 (v varchar(65530), key(v));
 
933
--error 1074
 
934
create table t1 (v varchar(65536));
 
935
--error 1074
 
936
create table t1 (v varchar(65530));
814
937
 
815
938
# MyISAM specific varchar tests
816
 
--error ER_TOO_BIG_FIELDLENGTH
817
 
create temporary table t1 (v varchar(65535));
 
939
--error 1074
 
940
create table t1 (v varchar(65535));
818
941
 
819
942
eval set storage_engine=$default;
820
943
 
821
944
 
822
945
# BUG#9622 - ANALYZE TABLE and ALTER TABLE .. ENABLE INDEX produce
823
946
# different statistics on the same table with NULL values.
824
 
create temporary table t1 (a int, key(a)) engine=myisam;
 
947
create table t1 (a int, key(a));
825
948
 
826
949
insert into t1 values (1),(2),(3),(4),(NULL),(NULL),(NULL),(NULL);
827
950
analyze table t1;
835
958
 
836
959
 
837
960
#
 
961
# Bug#10056 - PACK_KEYS option take values greater than 1 while creating table
 
962
#
 
963
create table t1 (c1 int) engine=myisam pack_keys=0;
 
964
create table t2 (c1 int) engine=myisam pack_keys=1;
 
965
create table t3 (c1 int) engine=myisam pack_keys=default;
 
966
--error 1064
 
967
create table t4 (c1 int) engine=myisam pack_keys=2;
 
968
drop table t1, t2, t3;
 
969
 
 
970
 
 
971
#
838
972
# Bug#28476: force index on a disabled myisam index gives error 124
839
973
#
840
 
CREATE TEMPORARY TABLE t1(a INT, b INT, KEY inx (a), UNIQUE KEY uinx (b)) ENGINE=MyISAM;
 
974
CREATE TABLE t1(a INT, b INT, KEY inx (a), UNIQUE KEY uinx (b)) ENGINE=MyISAM;
841
975
INSERT INTO t1(a,b) VALUES (1,1),(2,2),(3,3),(4,4),(5,5);
842
976
SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1;
843
977
ALTER TABLE t1 DISABLE KEYS;
853
987
#
854
988
# Bug#4692 - DISABLE/ENABLE KEYS waste a space
855
989
#
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';
 
990
CREATE TABLE t1 (c1 INT, c2 INT, UNIQUE INDEX (c1), INDEX (c2)) ENGINE=MYISAM;
 
991
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
 
992
SHOW TABLE STATUS LIKE 't1';
859
993
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';
 
994
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
 
995
SHOW TABLE STATUS LIKE 't1';
 
996
ALTER TABLE t1 DISABLE KEYS;
 
997
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
 
998
SHOW TABLE STATUS LIKE 't1';
 
999
ALTER TABLE t1 ENABLE KEYS;
 
1000
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
 
1001
SHOW TABLE STATUS LIKE 't1';
 
1002
ALTER TABLE t1 DISABLE KEYS;
 
1003
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
 
1004
SHOW TABLE STATUS LIKE 't1';
 
1005
ALTER TABLE t1 ENABLE KEYS;
 
1006
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
 
1007
SHOW TABLE STATUS LIKE 't1';
874
1008
#--exec ls -log var/master-data/test/t1.MYI
875
1009
#--exec myisamchk -dvv var/master-data/test/t1.MYI
876
1010
#--exec myisamchk -iev var/master-data/test/t1.MYI
877
1011
--echo # Enable keys with parallel repair
 
1012
SET GLOBAL myisam_repair_threads=2;
878
1013
ALTER TABLE t1 DISABLE KEYS;
879
1014
ALTER TABLE t1 ENABLE KEYS;
880
 
CHECK TABLE t1;
 
1015
SET GLOBAL myisam_repair_threads=1;
 
1016
CHECK TABLE t1 EXTENDED;
881
1017
DROP TABLE t1;
882
1018
 
883
1019
#
884
1020
# Bug#28837: MyISAM storage engine error (134) doing delete with self-join
885
1021
#
886
 
# DRIZZLE NOTE: Cannot self join on temp tables.
887
 
CREATE TABLE t1 (id int NOT NULL, ref int NOT NULL, INDEX (id));
 
1022
 
 
1023
CREATE TABLE t1 (id int NOT NULL, ref int NOT NULL, INDEX (id)) ENGINE=MyISAM;
888
1024
CREATE TABLE t2 LIKE t1;
889
1025
 
890
1026
INSERT INTO t2 (id, ref) VALUES (1,3), (2,1), (3,2), (4,5), (4,4);
892
1028
 
893
1029
SELECT * FROM t1 AS a INNER JOIN t1 AS b USING (id) WHERE a.ref < b.ref;
894
1030
SELECT * FROM t1;
 
1031
DELETE FROM a USING t1 AS a INNER JOIN t1 AS b USING (id) WHERE a.ref < b.ref;
 
1032
SELECT * FROM t1;
895
1033
 
896
1034
DROP TABLE t1, t2;
897
1035
 
899
1037
 
900
1038
 
901
1039
#
 
1040
# Test of key_block_size
 
1041
#
 
1042
 
 
1043
create table t1 (a int not null, key `a` (a) key_block_size=1024) ENGINE=MyISAM;
 
1044
show create table t1;
 
1045
drop table t1;
 
1046
 
 
1047
create table t1 (a int not null, key `a` (a) key_block_size=2048) ENGINE=MyISAM;
 
1048
show create table t1;
 
1049
drop table t1;
 
1050
 
 
1051
create table t1 (a varchar(2048), key `a` (a)) ENGINE=MyISAM;
 
1052
show create table t1;
 
1053
drop table t1;
 
1054
 
 
1055
create table t1 (a varchar(2048), key `a` (a) key_block_size=1024) ENGINE=MyISAM;
 
1056
show create table t1;
 
1057
drop table t1;
 
1058
 
 
1059
create table t1 (a int not null, b varchar(2048), key (a), key(b)) ENGINE=MyISAM key_block_size=1024;
 
1060
show create table t1;
 
1061
alter table t1 key_block_size=2048;
 
1062
show create table t1;
 
1063
alter table t1 add c int, add key (c);
 
1064
show create table t1;
 
1065
alter table t1 key_block_size=0;
 
1066
alter table t1 add d int, add key (d);
 
1067
show create table t1;
 
1068
drop table t1;
 
1069
 
 
1070
create table t1 (a int not null, b varchar(2048), key (a), key(b)) ENGINE=MyISAM key_block_size=8192;
 
1071
show create table t1;
 
1072
drop table t1;
 
1073
 
 
1074
create table t1 (a int not null, b varchar(2048), key (a) key_block_size=1024, key(b)) ENGINE=MyISAM key_block_size=8192;
 
1075
show create table t1;
 
1076
drop table t1;
 
1077
 
 
1078
create 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;
 
1079
show create table t1;
 
1080
drop table t1;
 
1081
 
 
1082
 
 
1083
# Test limits and errors of key_block_size
 
1084
 
 
1085
create table t1 (a int not null, key `a` (a) key_block_size=512) ENGINE=MyISAM;
 
1086
show create table t1;
 
1087
drop table t1;
 
1088
 
 
1089
create table t1 (a varchar(2048), key `a` (a) key_block_size=1000000000000000000) ENGINE=MyISAM;
 
1090
show create table t1;
 
1091
drop table t1;
 
1092
 
 
1093
create table t1 (a int not null, key `a` (a) key_block_size=1025) ENGINE=MyISAM;
 
1094
show create table t1;
 
1095
drop table t1;
 
1096
 
 
1097
--error 1064
 
1098
create table t1 (a int not null, key key_block_size=1024 (a)) ENGINE=MyISAM;
 
1099
--error 1064
 
1100
create table t1 (a int not null, key `a` key_block_size=1024 (a)) ENGINE=MyISAM;
 
1101
 
 
1102
#
902
1103
# Bug#22119 - Changing MI_KEY_BLOCK_LENGTH makes a wrong myisamchk
903
1104
#
904
 
CREATE temporary TABLE t1 (
 
1105
CREATE TABLE t1 (
905
1106
  c1 INT,
906
1107
  c2 VARCHAR(300),
907
1108
  KEY (c1) KEY_BLOCK_SIZE 1024,
933
1134
  (33, REPEAT('x', CEIL(RAND() * 300))),
934
1135
  (34, REPEAT('y', CEIL(RAND() * 300))),
935
1136
  (35, REPEAT('z', CEIL(RAND() * 300)));
936
 
CREATE TEMPORARY TABLE t2 AS SELECT * FROM t1;
937
 
INSERT INTO t1 SELECT * FROM t2;
938
 
DROP TABLE t2;
939
 
CREATE TEMPORARY TABLE t2 AS SELECT * FROM t1;
940
 
INSERT INTO t1 SELECT * FROM t2;
941
 
DROP TABLE t2;
 
1137
INSERT INTO t1 SELECT * FROM t1;
 
1138
INSERT INTO t1 SELECT * FROM t1;
942
1139
CHECK TABLE t1;
943
1140
DELETE FROM t1 WHERE c1 >= 10;
944
1141
CHECK TABLE t1;
951
1148
# Test #1 - CHECK TABLE sees wrong record, REPAR TABLE deletes it.
952
1149
# Using a CHAR column that can have > 127 characters.
953
1150
# Using a VARCHAR to create a table with dynamic row format.
954
 
CREATE temporary TABLE t1 (
 
1151
CREATE TABLE t1 (
955
1152
  c1 CHAR(130),
956
1153
  c2 VARCHAR(1)
957
1154
) ENGINE=MyISAM;
965
1162
# Test #2 - same as test #1, but using EXTENDED.
966
1163
# Using a CHAR column that can have > 127 characters.
967
1164
# Using a VARCHAR to create a table with dynamic row format.
968
 
CREATE temporary TABLE t1 (
 
1165
CREATE TABLE t1 (
969
1166
  c1 CHAR(130),
970
1167
  c2 VARCHAR(1)
971
1168
) ENGINE=MyISAM;
972
1169
INSERT INTO t1 VALUES(REPEAT("a",128), 'b');
973
1170
SELECT COUNT(*) FROM t1;
974
 
CHECK TABLE t1;
 
1171
CHECK TABLE t1 EXTENDED;
975
1172
SELECT COUNT(*) FROM t1;
976
 
CHECK TABLE t1;
 
1173
CHECK TABLE t1 EXTENDED;
977
1174
DROP TABLE t1;
978
1175
#
979
1176
# Test #3 - same as test #1, but using OPTIMIZE TABLE.
980
1177
# Using a CHAR column that can have > 127 characters.
981
1178
# Using a VARCHAR to create a table with dynamic row format.
982
 
CREATE temporary TABLE t1 (
 
1179
CREATE TABLE t1 (
983
1180
  c1 CHAR(130),
984
1181
  c2 VARCHAR(1)
985
1182
) ENGINE=MyISAM;
989
1186
INSERT INTO t1 VALUES('c', 'b');
990
1187
DELETE FROM t1 WHERE c1='b';
991
1188
SELECT COUNT(*) FROM t1;
992
 
ALTER TABLE t1 ENGINE=MyISAM;
 
1189
OPTIMIZE TABLE t1;
993
1190
SELECT COUNT(*) FROM t1;
994
1191
DROP TABLE t1;
995
1192
#
997
1194
# Using a CHAR column that can have > 127 characters.
998
1195
# Using a VARCHAR to create a table with dynamic row format.
999
1196
# Using an index which can be disabled during bulk insert.
1000
 
CREATE temporary TABLE t1 (
 
1197
CREATE TABLE t1 (
1001
1198
  c1 CHAR(130),
1002
1199
  c2 VARCHAR(1),
1003
1200
  KEY (c1)
1024
1221
# With bug present, this shows that all long rows are gone.
1025
1222
SELECT COUNT(*) FROM t1;
1026
1223
CHECK TABLE t1;
1027
 
CHECK TABLE t1;
 
1224
CHECK TABLE t1 EXTENDED;
1028
1225
DROP TABLE t1;
1029
1226
#
1030
1227
# Test #5 - same as test #1 but UTF-8.
1031
1228
# Using a CHAR column that can have > 127 characters.
1032
1229
# Using a VARCHAR to create a table with dynamic row format.
1033
 
CREATE temporary TABLE t1 (
 
1230
CREATE TABLE t1 (
1034
1231
  c1 CHAR(50),
1035
1232
  c2 VARCHAR(1)
1036
1233
) ENGINE=MyISAM;
1045
1242
# Test #6 - same as test #2, but UTF-8.
1046
1243
# Using a CHAR column that can have > 127 characters.
1047
1244
# Using a VARCHAR to create a table with dynamic row format.
1048
 
CREATE temporary TABLE t1 (
 
1245
CREATE TABLE t1 (
1049
1246
  c1 CHAR(50),
1050
1247
  c2 VARCHAR(1)
1051
1248
) ENGINE=MyISAM;
1052
1249
# Using Tamil Letter A, Unicode U+0B85
1053
1250
INSERT INTO t1 VALUES(REPEAT( x'e0ae85',43), 'b');
1054
1251
SELECT COUNT(*) FROM t1;
1055
 
CHECK TABLE t1;
 
1252
CHECK TABLE t1 EXTENDED;
1056
1253
SELECT COUNT(*) FROM t1;
1057
 
CHECK TABLE t1;
 
1254
CHECK TABLE t1 EXTENDED;
1058
1255
DROP TABLE t1;
1059
1256
#
1060
1257
# Test #7 - same as test #3, but UTF-8.
1061
1258
# Using a CHAR column that can have > 127 characters.
1062
1259
# Using a VARCHAR to create a table with dynamic row format.
1063
 
CREATE temporary TABLE t1 (
 
1260
CREATE TABLE t1 (
1064
1261
  c1 CHAR(50),
1065
1262
  c2 VARCHAR(1)
1066
1263
) ENGINE=MyISAM;
1071
1268
INSERT INTO t1 VALUES('c', 'b');
1072
1269
DELETE FROM t1 WHERE c1='b';
1073
1270
SELECT COUNT(*) FROM t1;
1074
 
ALTER TABLE t1 ENGINE=MyISAM;
 
1271
OPTIMIZE TABLE t1;
1075
1272
SELECT COUNT(*) FROM t1;
1076
1273
DROP TABLE t1;
1077
1274
#
1079
1276
# Using a CHAR column that can have > 42 UTF-8 characters.
1080
1277
# Using a VARCHAR to create a table with dynamic row format.
1081
1278
# Using an index which can be disabled during bulk insert.
1082
 
CREATE temporary TABLE t1 (
 
1279
CREATE TABLE t1 (
1083
1280
  c1 CHAR(50),
1084
1281
  c2 VARCHAR(1),
1085
1282
  KEY (c1)
1107
1304
# With bug present, this shows that all long rows are gone.
1108
1305
SELECT COUNT(*) FROM t1;
1109
1306
CHECK TABLE t1;
1110
 
CHECK TABLE t1;
 
1307
CHECK TABLE t1 EXTENDED;
1111
1308
DROP TABLE t1;
 
1309
 
 
1310
#
 
1311
# Bug#29182 - MyISAMCHK reports wrong character set
 
1312
#
 
1313
#@TODO Disabling the below, as no myisamcheck program
 
1314
#CREATE TABLE t1 (
 
1315
#  c1 VARCHAR(10) NOT NULL,
 
1316
#  c2 CHAR(10) DEFAULT NULL,
 
1317
#  c3 VARCHAR(10) NOT NULL,
 
1318
#  KEY (c1),
 
1319
#  KEY (c2)
 
1320
#) ENGINE=MyISAM PACK_KEYS=0;
 
1321
#--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
1322
#--exec $DRIZZLECHK -d $MYSQLTEST_VARDIR/master-data/test/t1
 
1323
#DROP TABLE t1;
 
1324
#
1112
1325
--echo End of 5.1 tests
1113
1326