~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/myisam.test

mergeĀ mainline

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;
45
45
--enable_warnings
46
46
enable_query_log;
47
47
check table t1;
 
48
repair table t1;
48
49
 
49
50
# @TODO Because there are no notes on what the heck this
50
51
# is actually testing (which bug?), it's difficult to tell
54
55
#delete from t1 where (a & 1);
55
56
delete from t1 where (a mod 2) = 1;
56
57
check table t1;
 
58
repair table t1;
 
59
check table t1;
57
60
drop table t1;
58
61
 
59
62
#
60
63
# Test bug: Two optimize in a row reset index cardinality
61
64
#
62
65
 
63
 
create TEMPORARY table t1 (a int not null auto_increment, b int not null, primary key (a), index(b)) ENGINE=MYISAM;
 
66
create table t1 (a int not null auto_increment, b int not null, primary key (a), index(b));
64
67
insert into t1 (b) values (1),(2),(2),(2),(2);
65
 
alter table t1 engine=MYISAM;
 
68
optimize table t1;
66
69
show index from t1;
67
 
alter table t1 engine=MyISAM;
 
70
optimize table t1;
68
71
show index from t1;
69
72
drop table t1;
70
73
 
72
75
# Test of how ORDER BY works when doing it on the whole table
73
76
#
74
77
 
75
 
create temporary table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=myisam;
 
78
create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=myisam;
76
79
insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
77
80
explain select * from t1 order by a;
78
81
explain select * from t1 order by b;
85
88
drop table t1;
86
89
 
87
90
#
 
91
# Test of OPTIMIZE of locked and modified tables
 
92
#
 
93
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
 
94
INSERT INTO  t1 VALUES (1), (2), (3);
 
95
LOCK TABLES t1 WRITE;
 
96
INSERT INTO  t1 VALUES (1), (2), (3);
 
97
OPTIMIZE TABLE t1;
 
98
DROP TABLE t1;
 
99
 
 
100
#
88
101
# Test of optimize, when only mi_sort_index (but not mi_repair*) is done
89
102
# in ha_myisam::repair, and index size is changed (decreased).
90
103
#
91
104
 
92
 
create temporary table t1 ( t1 char(255), key(t1(250))) ENGINE=MYISAM;
 
105
create table t1 ( t1 char(255), key(t1(250)));
93
106
insert t1 values ('137513751375137513751375137513751375137569516951695169516951695169516951695169');
94
107
insert t1 values ('178417841784178417841784178417841784178403420342034203420342034203420342034203');
95
108
insert t1 values ('213872387238723872387238723872387238723867376737673767376737673767376737673767');
119
132
insert t1 values ('70'), ('84'), ('60'), ('20'), ('76'), ('89'), ('49'), ('50'),
120
133
('88'), ('61'), ('42'), ('98'), ('39'), ('30'), ('25'), ('66'), ('61'), ('48'),
121
134
('80'), ('84'), ('98'), ('19'), ('91'), ('42'), ('47');
122
 
alter table t1 ENGINE=myisam;
 
135
optimize table t1;
123
136
check table t1;
124
137
drop table t1;
125
138
 
127
140
# test of myisam with huge number of packed fields
128
141
#
129
142
 
130
 
create temporary table t1 (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8
 
143
create table t1 (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8
131
144
int, i9 int, i10 int, i11 int, i12 int, i13 int, i14 int, i15 int, i16 int, i17
132
145
int, i18 int, i19 int, i20 int, i21 int, i22 int, i23 int, i24 int, i25 int,
133
146
i26 int, i27 int, i28 int, i29 int, i30 int, i31 int, i32 int, i33 int, i34
302
315
#
303
316
# Test of REPAIR that once failed
304
317
#
305
 
CREATE TEMPORARY TABLE `t1` (
 
318
CREATE TABLE `t1` (
306
319
  `post_id` int NOT NULL auto_increment,
307
320
  `topic_id` int NOT NULL default '0',
308
321
  `post_time` datetime,
322
335
 
323
336
INSERT INTO t1 (post_text) VALUES ('ceci est un test'),('ceci est un test'),('ceci est un test'),('ceci est un test'),('ceci est un test');
324
337
 
 
338
# @TODO The REPAIR TABLE statement crashes server.
 
339
# Bug#309802: https://bugs.launchpad.net/drizzle/+bug/309802
 
340
# Commenting it out for now to proceed in testing. - JRP
 
341
# REPAIR TABLE t1;
325
342
CHECK TABLE t1;
326
343
drop table t1;
327
344
 
329
346
# Test of creating table with too long key
330
347
#
331
348
 
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
 
349
--error 1071
 
350
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;
 
351
CREATE TABLE t1 (a varchar(300), b varchar(300), c varchar(300), d varchar(300), e varchar(300)) ENGINE=MyISAM;
 
352
--error 1071
336
353
ALTER TABLE t1 ADD INDEX t1 (a, b, c, d, e);
337
354
DROP TABLE t1;
338
355
 
340
357
# Test of cardinality of keys with NULL
341
358
#
342
359
 
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;
 
360
CREATE TABLE t1 (a int not null, b int, c int, key(b), key(c), key(a,b), key(c,a)) ENGINE=MyISAM;
344
361
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;
 
362
create table t2 (a int not null, b int, c int, key(b), key(c), key(a));
346
363
INSERT into t2 values (1,1,1), (2,2,2);
347
 
alter table t1 ENGINE=MYISAM;
 
364
optimize table t1;
348
365
show index from t1;
349
366
explain select * from t1,t2 where t1.a=t2.a;
350
367
explain select * from t1,t2 force index(a) where t1.a=t2.a;
361
378
# Test bug when updating a split dynamic row where keys are not changed
362
379
#
363
380
 
364
 
create temporary table t1 (a int not null auto_increment primary key, b varchar(255)) engine=myisam;
 
381
create table t1 (a int not null auto_increment primary key, b varchar(255));
365
382
insert into t1 (b) values (repeat('a',100)),(repeat('b',100)),(repeat('c',100));
366
383
update t1 set b=repeat(left(b,1),200) where a=1;
367
384
 
406
423
#
407
424
# two bugs in myisam-space-stripping feature
408
425
#
409
 
create temporary table t1 ( a text not null, key a (a(20))) engine=myisam;
 
426
create table t1 ( a text not null, key a (a(20)));
410
427
insert into t1 values ('aaa   '),('aaa'),('aa');
411
428
check table t1;
 
429
repair table t1;
412
430
select concat(a,'.') from t1 where a='aaa';
413
431
select concat(a,'.') from t1 where binary a='aaa';
414
432
update t1 set a='bbb' where a='aaa';
419
437
# Third bug in the same code (BUG#2295)
420
438
#
421
439
 
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;
 
440
create table t1(a text not null, b text not null, c text not null, index (a(10),b(10),c(10)));
423
441
insert into t1 values('807780', '477', '165');
424
442
insert into t1 values('807780', '477', '162');
425
443
insert into t1 values('807780', '472', '162');
430
448
# space-stripping in _mi_prefix_search: BUG#5284
431
449
#
432
450
DROP TABLE IF EXISTS t1;
433
 
CREATE TEMPORARY TABLE t1 (a varchar(150) NOT NULL, KEY (a)) ENGINE=MyISAM; 
 
451
CREATE TABLE t1 (a varchar(150) NOT NULL, KEY (a)) ENGINE=MyISAM; 
434
452
INSERT t1 VALUES ("can \tcan"); 
435
453
INSERT t1 VALUES ("can   can"); 
436
454
INSERT t1 VALUES ("can"); 
441
459
#
442
460
# Verify blob handling
443
461
#
444
 
create temporary table t1 (a blob) engine=myisam;
 
462
create table t1 (a blob);
445
463
insert into t1 values('a '),('a');
446
464
select concat(a,'.') from t1 where a='a';
447
465
select concat(a,'.') from t1 where a='a ';
453
471
#
454
472
# Test text and unique
455
473
#
456
 
create temporary table t1 (a int not null auto_increment primary key, b text not null, unique b (b(20))) engine=myisam;
 
474
create table t1 (a int not null auto_increment primary key, b text not null, unique b (b(20)));
457
475
insert into t1 (b) values ('a'),('b'),('c');
458
476
select concat(b,'.') from t1;
459
477
update t1 set b='b ' where a=2;
469
487
#
470
488
# Test keys with 0 segments. (Bug #3203)
471
489
#
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;
 
490
create table t1 (a int not null);
 
491
create table t2 (a int not null, primary key (a));
474
492
insert into t1 values (1);
475
493
insert into t2 values (1),(2);
476
494
select sql_big_result distinct t1.a from t1,t2 order by t2.a;
483
501
#
484
502
# Bug#14616 - Freshly imported table returns error 124 when using LIMIT
485
503
#
486
 
create temporary table t1 (
 
504
create table t1 (
487
505
  c1 varchar(32),
488
506
  key (c1)
489
507
) engine=myisam;
492
510
select c1 from t1 order by c1 limit 1;
493
511
drop table t1;
494
512
 
 
513
#
 
514
# Bug #14400  Join could miss concurrently inserted row
 
515
#
 
516
# @TODO The below test hangs drizzle. Commenting out for now so I can continue with this test. - JRP
 
517
#
 
518
# Partial key.
 
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);
 
527
#disconnect root;
 
528
#connection default;
 
529
#select straight_join * from t1,t2 force index (primary) where t1.a=t2.a;
 
530
#unlock tables;
 
531
#drop table t1,t2;
 
532
#
 
533
# Full key.
 
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,,);
 
542
#connection con1;
 
543
#INSERT INTO t2 VALUES ('test000001'), ('test000005');
 
544
#disconnect con1;
 
545
#connection default;
 
546
#SELECT t1.c1 AS t1c1, t2.c1 AS t2c1 FROM t1, t2
 
547
#  WHERE t1.c1 = t2.c1 HAVING t1c1 != t2c1;
 
548
#UNLOCK TABLES;
 
549
#DROP TABLE t1,t2;
 
550
 
495
551
# End of 4.0 tests
496
552
 
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 #
502
 
show table status;
 
557
checksum table t1, t2, t3 quick;
 
558
checksum table t1, t2, t3;
 
559
checksum table t1, t2, t3 extended;
 
560
#show table status;
503
561
drop table t1,t2;
504
562
 
505
563
#@TODO Figure out what the heck the below is testing.
523
581
#show keys from t1;
524
582
#alter table t1 enable keys;
525
583
#show keys from t1;
526
 
#alter table t1 engine=MEMORY;
 
584
#alter table t1 engine=heap;
527
585
#alter table t1 disable keys;
528
586
#show keys from t1;
529
587
#drop table t1,t2;
531
589
#
532
590
# index search for NULL in blob. Bug #4816
533
591
#
534
 
create temporary table t1 ( a tinytext, b char(1), index idx (a(1),b) ) engine=myisam;
 
592
create table t1 ( a tinytext, b char(1), index idx (a(1),b) );
535
593
insert into t1 values (null,''), (null,'');
536
594
explain select count(*) from t1 where a is null;
537
595
select count(*) from t1 where a is null;
540
598
#
541
599
# bug9188 - Corruption Can't open file: 'table.MYI' (errno: 145)
542
600
#
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 '',
 
602
                 key(c2(3)));
545
603
insert into t1 values (1,'A'), (2, 'B'), (3, 'A');
546
604
update t1 set c2='A  B' where c1=2;
547
605
check table t1;
548
606
drop table t1;
549
607
 
 
608
 
 
609
#
 
610
# Bug#12296 - CHECKSUM TABLE reports 0 for the table
 
611
# This happened if the first record was marked as deleted.
 
612
#
 
613
create table t1 (c1 int);
 
614
insert into t1 values (1),(2),(3),(4);
 
615
checksum table t1;
 
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.
 
619
checksum table t1;
 
620
# The above should give the same number as the following.
 
621
checksum table t2;
 
622
drop table t1, t2;
 
623
 
 
624
#
 
625
# BUG#12232: New myisam_stats_method variable.
 
626
#
 
627
# @TODO The following segfaults. Disabling for now - JRP
 
628
#
 
629
#show variables like 'myisam_stats_method';
 
630
#
 
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;
 
634
 
 
635
# default: NULLs considered inequal
 
636
#analyze table t1; 
 
637
#show index from t1;
 
638
#insert into t1 values (11);
 
639
#delete from t1 where a=11;
 
640
#check table t1;
 
641
#show index from t1;
 
642
 
 
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;
 
648
 
 
649
#analyze table t1; 
 
650
#show index from t1;
 
651
#
 
652
#insert into t1 values (11);
 
653
#delete from t1 where a=11;
 
654
#
 
655
#check table t1;
 
656
#show index from t1;
 
657
#
 
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;
 
663
#
 
664
#analyze table t1; 
 
665
#show index from t1;
 
666
#
 
667
#insert into t1 values (11);
 
668
#delete from t1 where a=11;
 
669
#
 
670
#check table t1;
 
671
#show index from t1;
 
672
#
 
673
#drop table t1;
 
674
 
 
675
# WL#2609, CSC#XXXX: MyISAM 
 
676
#set myisam_stats_method=nulls_ignored;
 
677
#show variables like 'myisam_stats_method';
 
678
#
 
679
#create table t1 (
 
680
#  a char(3), b char(4), c char(5), d char(6),
 
681
#  key(a,b,c,d)
 
682
#);
 
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');
 
687
#analyze table t1;
 
688
#show index from t1;
 
689
#delete from t1;
 
690
#analyze table t1;
 
691
#show index from t1;
 
692
#
 
693
#set myisam_stats_method=DEFAULT;
 
694
#drop table t1;
 
695
 
550
696
# BUG#13814 - key value packed incorrectly for TINYBLOBs
551
697
 
552
 
create temporary table t1(
 
698
create table t1(
553
699
  cip INT NOT NULL,
554
700
  score INT NOT NULL DEFAULT 0,
555
701
  bob TINYBLOB
556
 
) engine=myisam;
 
702
);
557
703
 
558
704
insert into t1 (cip) VALUES (1), (2), (3);
559
705
insert into t1 (cip, bob) VALUES (4, 'a' ), (5, 'b'), 
566
712
#
567
713
# Bug#14980 - COUNT(*) incorrect on MyISAM table with certain INDEX
568
714
#
569
 
create temporary table t1 (
 
715
create table t1 (
570
716
  id1 int not null auto_increment,
571
717
  id2 int not null default '0',
572
718
  t text not null,
585
731
# BUG##20357 - Got error 124 from storage engine using MIN and MAX functions
586
732
#              in queries
587
733
#
588
 
CREATE TEMPORARY TABLE t1(a int, KEY(a)) ENGINE=MyISAM;
 
734
CREATE TABLE t1(a int, KEY(a)) ENGINE=MyISAM;
589
735
INSERT INTO t1 VALUES(1);
590
736
SELECT MAX(a) FROM t1 IGNORE INDEX(a);
591
737
ALTER TABLE t1 DISABLE KEYS;
594
740
DROP TABLE t1;
595
741
 
596
742
#
 
743
# BUG#18036 - update of table joined to self reports table as crashed
 
744
#
 
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';
 
748
SELECT * FROM t1;
 
749
DROP TABLE t1;
 
750
 
 
751
#
597
752
# Bug#8283 - OPTIMIZE TABLE causes data loss
598
753
#
 
754
SET GLOBAL myisam_repair_threads=2;
 
755
SHOW VARIABLES LIKE 'myisam_repair%';
 
756
#
599
757
# Test OPTIMIZE. This creates a new data file.
600
 
CREATE TEMPORARY TABLE t1 (
601
 
  `_id` int NOT NULL default '0',
602
 
  `url` text,
603
 
  `email` text,
604
 
  `description` text,
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,
610
 
  `sequence` text,
611
 
  `name` text,
612
 
  `_obj_class` text NOT NULL,
613
 
  PRIMARY KEY  (`_id`),
614
 
  UNIQUE KEY `sequence_name_index` (`name`(50)),
615
 
  KEY (`length_`)
616
 
) ENGINE=MyISAM;
617
 
 
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','');
628
 
#
629
 
SELECT _id FROM t1;
630
 
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';
638
 
SELECT _id FROM t1;
 
758
CREATE TABLE t1 (
 
759
  `_id` int NOT NULL default '0',
 
760
  `url` text,
 
761
  `email` text,
 
762
  `description` text,
 
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,
 
768
  `sequence` text,
 
769
  `name` text,
 
770
  `_obj_class` text NOT NULL,
 
771
  PRIMARY KEY  (`_id`),
 
772
  UNIQUE KEY `sequence_name_index` (`name`(50)),
 
773
  KEY (`length_`)
 
774
) ENGINE=MyISAM;
 
775
 
 
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','');
 
786
#
 
787
SELECT _id FROM t1;
 
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;
 
792
OPTIMIZE TABLE t1;
 
793
CHECK TABLE t1 EXTENDED;
 
794
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
 
795
SHOW TABLE STATUS LIKE 't1';
 
796
SELECT _id FROM t1;
 
797
DROP TABLE t1;
 
798
#
 
799
# Test REPAIR QUICK. This retains the old data file.
 
800
CREATE TABLE t1 (
 
801
  `_id` int NOT NULL default '0',
 
802
  `url` text,
 
803
  `email` text,
 
804
  `description` text,
 
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,
 
810
  `sequence` text,
 
811
  `name` text,
 
812
  `_obj_class` text NOT NULL,
 
813
  PRIMARY KEY  (`_id`),
 
814
  UNIQUE KEY `sequence_name_index` (`name`(50)),
 
815
  KEY (`length_`)
 
816
) ENGINE=MyISAM;
 
817
 
 
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','');
 
828
#
 
829
SELECT _id FROM t1;
 
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';
 
838
SELECT _id FROM t1;
 
839
DROP TABLE t1;
 
840
#
 
841
SET GLOBAL myisam_repair_threads=1;
 
842
SHOW VARIABLES LIKE 'myisam_repair%';
 
843
 
 
844
#
 
845
# BUG#21310 - Trees in SQL causing a "crashed" table with MyISAM storage
 
846
#             engine
 
847
#
 
848
 
 
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';
 
853
SELECT * FROM t1;
 
854
DROP TABLE t1;
 
855
 
 
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;
639
861
DROP TABLE t1;
640
862
 
641
863
#
642
864
# Bug#24607 - MyISAM pointer size determined incorrectly
643
865
#
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';
647
869
DROP TABLE t1;
648
870
 
649
871
#
650
872
# Bug#26231 - select count(*) on myisam table returns wrong value
651
873
#             when index is used
652
874
#
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)),
798
1020
 
799
1021
let $default=`select @@storage_engine`;
800
1022
set storage_engine=MyISAM;
801
 
let $temp= TEMPORARY;
802
1023
source include/varchar.inc;
803
1024
 
804
1025
#
805
1026
# Some errors/warnings on create
806
1027
#
807
1028
 
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));
 
1029
--error 1074
 
1030
create table t1 (v varchar(65530), key(v));
 
1031
--error 1074
 
1032
create table t1 (v varchar(65536));
 
1033
--error 1074
 
1034
create table t1 (v varchar(65530));
814
1035
 
815
1036
# MyISAM specific varchar tests
816
 
--error ER_TOO_BIG_FIELDLENGTH
817
 
create temporary table t1 (v varchar(65535));
 
1037
--error 1074
 
1038
create table t1 (v varchar(65535));
818
1039
 
819
1040
eval set storage_engine=$default;
820
1041
 
 
1042
#
 
1043
# Test concurrent insert
 
1044
# First with static record length
 
1045
#
 
1046
#@TODO The below test fails with unknown system variable
 
1047
#      concurrent_insert
 
1048
#
 
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,,);
 
1055
#connection con1;
 
1056
# Insert in table without hole
 
1057
#insert into t1 values(6),(7);
 
1058
#connection default;
 
1059
#unlock tables;
 
1060
#delete from t1 where a>=3 and a<=4;
 
1061
#lock table t1 read local;
 
1062
#connection con1;
 
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;
 
1067
#unlock tables;
 
1068
# Insert into hole
 
1069
#insert into t1 values (10),(11),(12);
 
1070
#select * from t1;
 
1071
#check table t1;
 
1072
#drop table t1;
 
1073
#disconnect con1;
 
1074
 
 
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,,);
 
1080
#connection con1;
 
1081
# Insert in table without hole
 
1082
#insert into t1 (a) values(6),(7);
 
1083
#connection default;
 
1084
#unlock tables;
 
1085
#delete from t1 where a>=3 and a<=4;
 
1086
#lock table t1 read local;
 
1087
#connection con1;
 
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;
 
1092
#unlock tables;
 
1093
# Insert into hole
 
1094
#insert into t1 (a) values (10),(11),(12);
 
1095
#select a from t1;
 
1096
#check table t1;
 
1097
#drop table t1;
 
1098
#disconnect con1;
 
1099
#set global concurrent_insert=@save_concurrent_insert;
 
1100
 
821
1101
 
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));
825
1105
 
826
1106
insert into t1 values (1),(2),(3),(4),(NULL),(NULL),(NULL),(NULL);
827
1107
analyze table t1;
835
1115
 
836
1116
 
837
1117
#
 
1118
# Bug#10056 - PACK_KEYS option take values greater than 1 while creating table
 
1119
#
 
1120
create table t1 (c1 int) engine=myisam pack_keys=0;
 
1121
create table t2 (c1 int) engine=myisam pack_keys=1;
 
1122
create table t3 (c1 int) engine=myisam pack_keys=default;
 
1123
--error 1064
 
1124
create table t4 (c1 int) engine=myisam pack_keys=2;
 
1125
drop table t1, t2, t3;
 
1126
 
 
1127
 
 
1128
#
838
1129
# Bug#28476: force index on a disabled myisam index gives error 124
839
1130
#
840
 
CREATE TEMPORARY TABLE t1(a INT, b INT, KEY inx (a), UNIQUE KEY uinx (b)) ENGINE=MyISAM;
 
1131
CREATE TABLE t1(a INT, b INT, KEY inx (a), UNIQUE KEY uinx (b)) ENGINE=MyISAM;
841
1132
INSERT INTO t1(a,b) VALUES (1,1),(2,2),(3,3),(4,4),(5,5);
842
1133
SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1;
843
1134
ALTER TABLE t1 DISABLE KEYS;
853
1144
#
854
1145
# Bug#4692 - DISABLE/ENABLE KEYS waste a space
855
1146
#
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;
880
 
CHECK TABLE t1;
 
1172
SET GLOBAL myisam_repair_threads=1;
 
1173
CHECK TABLE t1 EXTENDED;
881
1174
DROP TABLE t1;
882
1175
 
883
1176
#
884
1177
# Bug#28837: MyISAM storage engine error (134) doing delete with self-join
885
1178
#
886
 
# DRIZZLE NOTE: Cannot self join on temp tables.
887
 
CREATE TABLE t1 (id int NOT NULL, ref int NOT NULL, INDEX (id));
 
1179
 
 
1180
CREATE TABLE t1 (id int NOT NULL, ref int NOT NULL, INDEX (id)) ENGINE=MyISAM;
888
1181
CREATE TABLE t2 LIKE t1;
889
1182
 
890
1183
INSERT INTO t2 (id, ref) VALUES (1,3), (2,1), (3,2), (4,5), (4,4);
892
1185
 
893
1186
SELECT * FROM t1 AS a INNER JOIN t1 AS b USING (id) WHERE a.ref < b.ref;
894
1187
SELECT * FROM t1;
 
1188
DELETE FROM a USING t1 AS a INNER JOIN t1 AS b USING (id) WHERE a.ref < b.ref;
 
1189
SELECT * FROM t1;
895
1190
 
896
1191
DROP TABLE t1, t2;
897
1192
 
899
1194
 
900
1195
 
901
1196
#
 
1197
# Test of key_block_size
 
1198
#
 
1199
 
 
1200
create table t1 (a int not null, key `a` (a) key_block_size=1024) ENGINE=MyISAM;
 
1201
show create table t1;
 
1202
drop table t1;
 
1203
 
 
1204
create table t1 (a int not null, key `a` (a) key_block_size=2048) ENGINE=MyISAM;
 
1205
show create table t1;
 
1206
drop table t1;
 
1207
 
 
1208
create table t1 (a varchar(2048), key `a` (a)) ENGINE=MyISAM;
 
1209
show create table t1;
 
1210
drop table t1;
 
1211
 
 
1212
create table t1 (a varchar(2048), key `a` (a) key_block_size=1024) ENGINE=MyISAM;
 
1213
show create table t1;
 
1214
drop table t1;
 
1215
 
 
1216
create table t1 (a int not null, b varchar(2048), key (a), key(b)) ENGINE=MyISAM key_block_size=1024;
 
1217
show create table t1;
 
1218
alter table t1 key_block_size=2048;
 
1219
show create table t1;
 
1220
alter table t1 add c int, add key (c);
 
1221
show create table t1;
 
1222
alter table t1 key_block_size=0;
 
1223
alter table t1 add d int, add key (d);
 
1224
show create table t1;
 
1225
drop table t1;
 
1226
 
 
1227
create table t1 (a int not null, b varchar(2048), key (a), key(b)) ENGINE=MyISAM key_block_size=8192;
 
1228
show create table t1;
 
1229
drop table t1;
 
1230
 
 
1231
create table t1 (a int not null, b varchar(2048), key (a) key_block_size=1024, key(b)) ENGINE=MyISAM key_block_size=8192;
 
1232
show create table t1;
 
1233
drop table t1;
 
1234
 
 
1235
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;
 
1236
show create table t1;
 
1237
drop table t1;
 
1238
 
 
1239
 
 
1240
# Test limits and errors of key_block_size
 
1241
 
 
1242
create table t1 (a int not null, key `a` (a) key_block_size=512) ENGINE=MyISAM;
 
1243
show create table t1;
 
1244
drop table t1;
 
1245
 
 
1246
create table t1 (a varchar(2048), key `a` (a) key_block_size=1000000000000000000) ENGINE=MyISAM;
 
1247
show create table t1;
 
1248
drop table t1;
 
1249
 
 
1250
create table t1 (a int not null, key `a` (a) key_block_size=1025) ENGINE=MyISAM;
 
1251
show create table t1;
 
1252
drop table t1;
 
1253
 
 
1254
--error 1064
 
1255
create table t1 (a int not null, key key_block_size=1024 (a)) ENGINE=MyISAM;
 
1256
--error 1064
 
1257
create table t1 (a int not null, key `a` key_block_size=1024 (a)) ENGINE=MyISAM;
 
1258
 
 
1259
#
902
1260
# Bug#22119 - Changing MI_KEY_BLOCK_LENGTH makes a wrong myisamchk
903
1261
#
904
 
CREATE temporary TABLE t1 (
 
1262
CREATE TABLE t1 (
905
1263
  c1 INT,
906
1264
  c2 VARCHAR(300),
907
1265
  KEY (c1) KEY_BLOCK_SIZE 1024,
933
1291
  (33, REPEAT('x', CEIL(RAND() * 300))),
934
1292
  (34, REPEAT('y', CEIL(RAND() * 300))),
935
1293
  (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;
 
1294
INSERT INTO t1 SELECT * FROM t1;
 
1295
INSERT INTO t1 SELECT * FROM t1;
942
1296
CHECK TABLE t1;
 
1297
REPAIR TABLE t1;
943
1298
DELETE FROM t1 WHERE c1 >= 10;
944
1299
CHECK TABLE t1;
945
1300
DROP TABLE t1;
951
1306
# Test #1 - CHECK TABLE sees wrong record, REPAR TABLE deletes it.
952
1307
# Using a CHAR column that can have > 127 characters.
953
1308
# Using a VARCHAR to create a table with dynamic row format.
954
 
CREATE temporary TABLE t1 (
 
1309
CREATE TABLE t1 (
955
1310
  c1 CHAR(130),
956
1311
  c2 VARCHAR(1)
957
1312
) ENGINE=MyISAM;
958
1313
INSERT INTO t1 VALUES(REPEAT("a",128), 'b');
959
1314
SELECT COUNT(*) FROM t1;
960
1315
CHECK TABLE t1;
 
1316
REPAIR TABLE t1;
961
1317
SELECT COUNT(*) FROM t1;
962
1318
CHECK TABLE t1;
963
1319
DROP TABLE t1;
965
1321
# Test #2 - same as test #1, but using EXTENDED.
966
1322
# Using a CHAR column that can have > 127 characters.
967
1323
# Using a VARCHAR to create a table with dynamic row format.
968
 
CREATE temporary TABLE t1 (
 
1324
CREATE TABLE t1 (
969
1325
  c1 CHAR(130),
970
1326
  c2 VARCHAR(1)
971
1327
) ENGINE=MyISAM;
972
1328
INSERT INTO t1 VALUES(REPEAT("a",128), 'b');
973
1329
SELECT COUNT(*) FROM t1;
974
 
CHECK TABLE t1;
 
1330
CHECK TABLE t1 EXTENDED;
 
1331
REPAIR TABLE t1 EXTENDED;
975
1332
SELECT COUNT(*) FROM t1;
976
 
CHECK TABLE t1;
 
1333
CHECK TABLE t1 EXTENDED;
977
1334
DROP TABLE t1;
978
1335
#
979
1336
# Test #3 - same as test #1, but using OPTIMIZE TABLE.
980
1337
# Using a CHAR column that can have > 127 characters.
981
1338
# Using a VARCHAR to create a table with dynamic row format.
982
 
CREATE temporary TABLE t1 (
 
1339
CREATE TABLE t1 (
983
1340
  c1 CHAR(130),
984
1341
  c2 VARCHAR(1)
985
1342
) ENGINE=MyISAM;
989
1346
INSERT INTO t1 VALUES('c', 'b');
990
1347
DELETE FROM t1 WHERE c1='b';
991
1348
SELECT COUNT(*) FROM t1;
992
 
ALTER TABLE t1 ENGINE=MyISAM;
 
1349
OPTIMIZE TABLE t1;
993
1350
SELECT COUNT(*) FROM t1;
994
1351
DROP TABLE t1;
995
1352
#
997
1354
# Using a CHAR column that can have > 127 characters.
998
1355
# Using a VARCHAR to create a table with dynamic row format.
999
1356
# Using an index which can be disabled during bulk insert.
1000
 
CREATE temporary TABLE t1 (
 
1357
CREATE TABLE t1 (
1001
1358
  c1 CHAR(130),
1002
1359
  c2 VARCHAR(1),
1003
1360
  KEY (c1)
1024
1381
# With bug present, this shows that all long rows are gone.
1025
1382
SELECT COUNT(*) FROM t1;
1026
1383
CHECK TABLE t1;
1027
 
CHECK TABLE t1;
 
1384
CHECK TABLE t1 EXTENDED;
1028
1385
DROP TABLE t1;
1029
1386
#
1030
1387
# Test #5 - same as test #1 but UTF-8.
1031
1388
# Using a CHAR column that can have > 127 characters.
1032
1389
# Using a VARCHAR to create a table with dynamic row format.
1033
 
CREATE temporary TABLE t1 (
 
1390
CREATE TABLE t1 (
1034
1391
  c1 CHAR(50),
1035
1392
  c2 VARCHAR(1)
1036
1393
) ENGINE=MyISAM;
1038
1395
INSERT INTO t1 VALUES(REPEAT( x'e0ae85',43), 'b');
1039
1396
SELECT COUNT(*) FROM t1;
1040
1397
CHECK TABLE t1;
 
1398
REPAIR TABLE t1;
1041
1399
SELECT COUNT(*) FROM t1;
1042
1400
CHECK TABLE t1;
1043
1401
DROP TABLE t1;
1045
1403
# Test #6 - same as test #2, but UTF-8.
1046
1404
# Using a CHAR column that can have > 127 characters.
1047
1405
# Using a VARCHAR to create a table with dynamic row format.
1048
 
CREATE temporary TABLE t1 (
 
1406
CREATE TABLE t1 (
1049
1407
  c1 CHAR(50),
1050
1408
  c2 VARCHAR(1)
1051
1409
) ENGINE=MyISAM;
1052
1410
# Using Tamil Letter A, Unicode U+0B85
1053
1411
INSERT INTO t1 VALUES(REPEAT( x'e0ae85',43), 'b');
1054
1412
SELECT COUNT(*) FROM t1;
1055
 
CHECK TABLE t1;
 
1413
CHECK TABLE t1 EXTENDED;
 
1414
REPAIR TABLE t1 EXTENDED;
1056
1415
SELECT COUNT(*) FROM t1;
1057
 
CHECK TABLE t1;
 
1416
CHECK TABLE t1 EXTENDED;
1058
1417
DROP TABLE t1;
1059
1418
#
1060
1419
# Test #7 - same as test #3, but UTF-8.
1061
1420
# Using a CHAR column that can have > 127 characters.
1062
1421
# Using a VARCHAR to create a table with dynamic row format.
1063
 
CREATE temporary TABLE t1 (
 
1422
CREATE TABLE t1 (
1064
1423
  c1 CHAR(50),
1065
1424
  c2 VARCHAR(1)
1066
1425
) ENGINE=MyISAM;
1071
1430
INSERT INTO t1 VALUES('c', 'b');
1072
1431
DELETE FROM t1 WHERE c1='b';
1073
1432
SELECT COUNT(*) FROM t1;
1074
 
ALTER TABLE t1 ENGINE=MyISAM;
 
1433
OPTIMIZE TABLE t1;
1075
1434
SELECT COUNT(*) FROM t1;
1076
1435
DROP TABLE t1;
1077
1436
#
1079
1438
# Using a CHAR column that can have > 42 UTF-8 characters.
1080
1439
# Using a VARCHAR to create a table with dynamic row format.
1081
1440
# Using an index which can be disabled during bulk insert.
1082
 
CREATE temporary TABLE t1 (
 
1441
CREATE TABLE t1 (
1083
1442
  c1 CHAR(50),
1084
1443
  c2 VARCHAR(1),
1085
1444
  KEY (c1)
1107
1466
# With bug present, this shows that all long rows are gone.
1108
1467
SELECT COUNT(*) FROM t1;
1109
1468
CHECK TABLE t1;
1110
 
CHECK TABLE t1;
 
1469
CHECK TABLE t1 EXTENDED;
1111
1470
DROP TABLE t1;
 
1471
 
 
1472
#
 
1473
# Bug#29182 - MyISAMCHK reports wrong character set
 
1474
#
 
1475
#@TODO Disabling the below, as no myisamcheck program
 
1476
#CREATE TABLE t1 (
 
1477
#  c1 VARCHAR(10) NOT NULL,
 
1478
#  c2 CHAR(10) DEFAULT NULL,
 
1479
#  c3 VARCHAR(10) NOT NULL,
 
1480
#  KEY (c1),
 
1481
#  KEY (c2)
 
1482
#) ENGINE=MyISAM PACK_KEYS=0;
 
1483
#--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
1484
#--exec $DRIZZLECHK -d $MYSQLTEST_VARDIR/master-data/test/t1
 
1485
#DROP TABLE t1;
 
1486
#
1112
1487
--echo End of 5.1 tests
1113
1488