~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/suite/broken/t/myisam.test

  • Committer: Lee
  • Date: 2009-01-01 03:07:33 UTC
  • mto: (758.1.3 devel)
  • mto: This revision was merged to the branch mainline in revision 759.
  • Revision ID: lbieber@lbieber-desktop-20090101030733-fb411b55f07vij8q
more header file cleanup

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);
 
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
 
  `post_time` datetime,
 
321
  `post_time` datetime NOT NULL default '0000-00-00 00:00:00',
309
322
  `post_text` text NOT NULL,
310
323
  `icon_url` varchar(10) NOT NULL default '',
311
324
  `sign` int NOT NULL default '0',
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));
 
351
CREATE TABLE t1 (a varchar(300), b varchar(300), c varchar(300), d varchar(300), e varchar(300));
 
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));
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)); 
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
# Partial key.
 
517
create table t1 (a int not null, primary key(a));
 
518
create table t2 (a int not null, b int not null, primary key(a,b));
 
519
insert into t1 values (1),(2),(3),(4),(5),(6);
 
520
insert into t2 values (1,1),(2,1);
 
521
lock tables t1 read local, t2 read local;
 
522
select straight_join * from t1,t2 force index (primary) where t1.a=t2.a;
 
523
connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
 
524
insert into t2 values(2,0);
 
525
disconnect root;
 
526
connection default;
 
527
select straight_join * from t1,t2 force index (primary) where t1.a=t2.a;
 
528
unlock tables;
 
529
drop table t1,t2;
 
530
#
 
531
# Full key.
 
532
CREATE TABLE t1 (c1 varchar(250) NOT NULL);
 
533
CREATE TABLE t2 (c1 varchar(250) NOT NULL, PRIMARY KEY (c1));
 
534
INSERT INTO t1 VALUES ('test000001'), ('test000002'), ('test000003');
 
535
INSERT INTO t2 VALUES ('test000002'), ('test000003'), ('test000004');
 
536
LOCK TABLES t1 READ LOCAL, t2 READ LOCAL;
 
537
SELECT t1.c1 AS t1c1, t2.c1 AS t2c1 FROM t1, t2
 
538
  WHERE t1.c1 = t2.c1 HAVING t1c1 != t2c1;
 
539
connect (con1,localhost,root,,);
 
540
connection con1;
 
541
INSERT INTO t2 VALUES ('test000001'), ('test000005');
 
542
disconnect con1;
 
543
connection default;
 
544
SELECT t1.c1 AS t1c1, t2.c1 AS t2c1 FROM t1, t2
 
545
  WHERE t1.c1 = t2.c1 HAVING t1c1 != t2c1;
 
546
UNLOCK TABLES;
 
547
DROP TABLE t1,t2;
 
548
 
495
549
# End of 4.0 tests
496
550
 
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;
 
551
#
 
552
# Test RTREE index
 
553
#
 
554
--error 1235, 1289
 
555
CREATE TABLE t1 (`a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', UNIQUE KEY `a` USING RTREE (`a`,`b`)) ENGINE=MyISAM;
 
556
# INSERT INTO t1 VALUES (1,1),(1,1);
 
557
# DELETE FROM rt WHERE a<1;
 
558
# DROP TABLE IF EXISTS t1;
 
559
 
 
560
create table t1 (a int, b varchar(200), c text not null) checksum=1;
 
561
create table t2 (a int, b varchar(200), c text not null) checksum=0;
499
562
insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
500
563
insert t2 select * from t1;
501
 
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
502
 
show table status;
 
564
checksum table t1, t2, t3 quick;
 
565
checksum table t1, t2, t3;
 
566
checksum table t1, t2, t3 extended;
 
567
#show table status;
503
568
drop table t1,t2;
504
569
 
505
 
#@TODO Figure out what the heck the below is testing.
506
 
#      It bombs the test with unknown system variables...
507
 
#
508
 
#create table t1 (a int, key (a));
509
 
#show keys from t1;
510
 
#alter table t1 disable keys;
511
 
#show keys from t1;
512
 
#create table t2 (a int);
513
 
#let $i=1000;
514
 
#set @@rand_seed1=31415926,@@rand_seed2=2718281828;
515
 
#--disable_query_log
516
 
#while ($i)
517
 
#{
518
 
#  dec $i;
519
 
#  insert t2 values (rand()*100000);
520
 
#}
521
 
#--enable_query_log
522
 
#insert t1 select * from t2;
523
 
#show keys from t1;
524
 
#alter table t1 enable keys;
525
 
#show keys from t1;
526
 
#alter table t1 engine=MEMORY;
527
 
#alter table t1 disable keys;
528
 
#show keys from t1;
529
 
#drop table t1,t2;
 
570
create table t1 (a int, key (a));
 
571
show keys from t1;
 
572
alter table t1 disable keys;
 
573
show keys from t1;
 
574
create table t2 (a int);
 
575
let $i=1000;
 
576
set @@rand_seed1=31415926,@@rand_seed2=2718281828;
 
577
--disable_query_log
 
578
while ($i)
 
579
{
 
580
  dec $i;
 
581
  insert t2 values (rand()*100000);
 
582
}
 
583
--enable_query_log
 
584
insert t1 select * from t2;
 
585
show keys from t1;
 
586
alter table t1 enable keys;
 
587
show keys from t1;
 
588
alter table t1 engine=heap;
 
589
alter table t1 disable keys;
 
590
show keys from t1;
 
591
drop table t1,t2;
530
592
 
531
593
#
532
594
# index search for NULL in blob. Bug #4816
533
595
#
534
 
create temporary table t1 ( a tinytext, b char(1), index idx (a(1),b) ) engine=myisam;
 
596
create table t1 ( a tinytext, b char(1), index idx (a(1),b) );
535
597
insert into t1 values (null,''), (null,'');
536
598
explain select count(*) from t1 where a is null;
537
599
select count(*) from t1 where a is null;
540
602
#
541
603
# bug9188 - Corruption Can't open file: 'table.MYI' (errno: 145)
542
604
#
543
 
create temporary table t1 (c1 int, c2 varchar(4) not null default '',
544
 
                 key(c2(3))) engine=myisam;
 
605
create table t1 (c1 int, c2 varchar(4) not null default '',
 
606
                 key(c2(3))) default charset=utf8;
545
607
insert into t1 values (1,'A'), (2, 'B'), (3, 'A');
546
608
update t1 set c2='A  B' where c1=2;
547
609
check table t1;
548
610
drop table t1;
549
611
 
 
612
 
 
613
#
 
614
# Bug#12296 - CHECKSUM TABLE reports 0 for the table
 
615
# This happened if the first record was marked as deleted.
 
616
#
 
617
create table t1 (c1 int);
 
618
insert into t1 values (1),(2),(3),(4);
 
619
checksum table t1;
 
620
delete from t1 where c1 = 1;
 
621
create table t2 as select * from t1;
 
622
# The following returns 0 with the bug in place.
 
623
checksum table t1;
 
624
# The above should give the same number as the following.
 
625
checksum table t2;
 
626
drop table t1, t2;
 
627
 
 
628
#
 
629
# BUG#12232: New myisam_stats_method variable.
 
630
#
 
631
 
 
632
show variables like 'myisam_stats_method';
 
633
 
 
634
create table t1 (a int, key(a));
 
635
insert into t1 values (0),(1),(2),(3),(4);
 
636
insert into t1 select NULL from t1;
 
637
 
 
638
# default: NULLs considered inequal
 
639
analyze table t1; 
 
640
show index from t1;
 
641
insert into t1 values (11);
 
642
delete from t1 where a=11;
 
643
check table t1;
 
644
show index from t1;
 
645
 
 
646
# Set nulls to be equal:
 
647
set myisam_stats_method=nulls_equal;
 
648
show variables like 'myisam_stats_method';
 
649
insert into t1 values (11);
 
650
delete from t1 where a=11;
 
651
 
 
652
analyze table t1; 
 
653
show index from t1;
 
654
 
 
655
insert into t1 values (11);
 
656
delete from t1 where a=11;
 
657
 
 
658
check table t1;
 
659
show index from t1;
 
660
 
 
661
# Set nulls back to be equal 
 
662
set myisam_stats_method=DEFAULT;
 
663
show variables like 'myisam_stats_method';
 
664
insert into t1 values (11);
 
665
delete from t1 where a=11;
 
666
 
 
667
analyze table t1; 
 
668
show index from t1;
 
669
 
 
670
insert into t1 values (11);
 
671
delete from t1 where a=11;
 
672
 
 
673
check table t1;
 
674
show index from t1;
 
675
 
 
676
drop table t1;
 
677
 
 
678
# WL#2609, CSC#XXXX: MyISAM 
 
679
set myisam_stats_method=nulls_ignored;
 
680
show variables like 'myisam_stats_method';
 
681
 
 
682
create table t1 (
 
683
  a char(3), b char(4), c char(5), d char(6),
 
684
  key(a,b,c,d)
 
685
);
 
686
insert into t1 values ('bcd','def1', NULL, 'zz');
 
687
insert into t1 values ('bcd','def2', NULL, 'zz');
 
688
insert into t1 values ('bce','def1', 'yuu', NULL);
 
689
insert into t1 values ('bce','def2', NULL, 'quux');
 
690
analyze table t1;
 
691
show index from t1;
 
692
delete from t1;
 
693
analyze table t1;
 
694
show index from t1;
 
695
 
 
696
set myisam_stats_method=DEFAULT;
 
697
drop table t1;
 
698
 
550
699
# BUG#13814 - key value packed incorrectly for TINYBLOBs
551
700
 
552
 
create temporary table t1(
 
701
create table t1(
553
702
  cip INT NOT NULL,
 
703
  time TIME NOT NULL,
554
704
  score INT NOT NULL DEFAULT 0,
555
705
  bob TINYBLOB
556
 
) engine=myisam;
 
706
);
557
707
 
558
 
insert into t1 (cip) VALUES (1), (2), (3);
559
 
insert into t1 (cip, bob) VALUES (4, 'a' ), (5, 'b'), 
560
 
                                       (6, 'c');
 
708
insert into t1 (cip, time) VALUES (1, '00:01'), (2, '00:02'), (3,'00:03');
 
709
insert into t1 (cip, bob, time) VALUES (4, 'a', '00:04'), (5, 'b', '00:05'), 
 
710
                                       (6, 'c', '00:06');
561
711
select * from t1 where bob is null and cip=1;
562
 
create index bug on t1 (bob(22), cip);
 
712
create index bug on t1 (bob(22), cip, time);
563
713
select * from t1 where bob is null and cip=1;
564
714
drop table t1;
565
715
 
566
716
#
567
717
# Bug#14980 - COUNT(*) incorrect on MyISAM table with certain INDEX
568
718
#
569
 
create temporary table t1 (
 
719
create table t1 (
570
720
  id1 int not null auto_increment,
571
721
  id2 int not null default '0',
572
722
  t text not null,
585
735
# BUG##20357 - Got error 124 from storage engine using MIN and MAX functions
586
736
#              in queries
587
737
#
588
 
CREATE TEMPORARY TABLE t1(a int, KEY(a)) ENGINE=MyISAM;
 
738
CREATE TABLE t1(a int, KEY(a)) ENGINE=MyISAM;
589
739
INSERT INTO t1 VALUES(1);
590
740
SELECT MAX(a) FROM t1 IGNORE INDEX(a);
591
741
ALTER TABLE t1 DISABLE KEYS;
594
744
DROP TABLE t1;
595
745
 
596
746
#
 
747
# BUG#18036 - update of table joined to self reports table as crashed
 
748
#
 
749
CREATE TABLE t1(a CHAR(9), b VARCHAR(7)) ENGINE=MyISAM;
 
750
INSERT INTO t1(a) VALUES('xxxxxxxxx'),('xxxxxxxxx');
 
751
UPDATE t1 AS ta1,t1 AS ta2 SET ta1.b='aaaaaa',ta2.b='bbbbbb';
 
752
SELECT * FROM t1;
 
753
DROP TABLE t1;
 
754
 
 
755
#
597
756
# Bug#8283 - OPTIMIZE TABLE causes data loss
598
757
#
 
758
SET @@myisam_repair_threads=2;
 
759
SHOW VARIABLES LIKE 'myisam_repair%';
 
760
#
599
761
# 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;
 
762
CREATE TABLE t1 (
 
763
  `_id` int NOT NULL default '0',
 
764
  `url` text,
 
765
  `email` text,
 
766
  `description` text,
 
767
  `loverlap` int default NULL,
 
768
  `roverlap` int default NULL,
 
769
  `lneighbor_id` int default NULL,
 
770
  `rneighbor_id` int default NULL,
 
771
  `length_` int default NULL,
 
772
  `sequence` mediumtext,
 
773
  `name` text,
 
774
  `_obj_class` text NOT NULL,
 
775
  PRIMARY KEY  (`_id`),
 
776
  UNIQUE KEY `sequence_name_index` (`name`(50)),
 
777
  KEY (`length_`)
 
778
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
779
#
 
780
INSERT INTO t1 VALUES
 
781
  (1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample1',''),
 
782
  (2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample2',''),
 
783
  (3,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample3',''),
 
784
  (4,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample4',''),
 
785
  (5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample5',''),
 
786
  (6,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample6',''),
 
787
  (7,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample7',''),
 
788
  (8,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample8',''),
 
789
  (9,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample9','');
 
790
#
 
791
SELECT _id FROM t1;
 
792
DELETE FROM t1 WHERE _id < 8;
 
793
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
 
794
SHOW TABLE STATUS LIKE 't1';
 
795
CHECK TABLE t1 EXTENDED;
 
796
OPTIMIZE TABLE t1;
 
797
CHECK TABLE t1 EXTENDED;
 
798
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
 
799
SHOW TABLE STATUS LIKE 't1';
 
800
SELECT _id FROM t1;
 
801
DROP TABLE t1;
 
802
#
 
803
# Test REPAIR QUICK. This retains the old data file.
 
804
CREATE TABLE t1 (
 
805
  `_id` int NOT NULL default '0',
 
806
  `url` text,
 
807
  `email` text,
 
808
  `description` text,
 
809
  `loverlap` int default NULL,
 
810
  `roverlap` int default NULL,
 
811
  `lneighbor_id` int default NULL,
 
812
  `rneighbor_id` int default NULL,
 
813
  `length_` int default NULL,
 
814
  `sequence` mediumtext,
 
815
  `name` text,
 
816
  `_obj_class` text NOT NULL,
 
817
  PRIMARY KEY  (`_id`),
 
818
  UNIQUE KEY `sequence_name_index` (`name`(50)),
 
819
  KEY (`length_`)
 
820
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
821
#
 
822
INSERT INTO t1 VALUES
 
823
  (1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample1',''),
 
824
  (2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample2',''),
 
825
  (3,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample3',''),
 
826
  (4,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample4',''),
 
827
  (5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample5',''),
 
828
  (6,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample6',''),
 
829
  (7,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample7',''),
 
830
  (8,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample8',''),
 
831
  (9,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample9','');
 
832
#
 
833
SELECT _id FROM t1;
 
834
DELETE FROM t1 WHERE _id < 8;
 
835
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
 
836
SHOW TABLE STATUS LIKE 't1';
 
837
CHECK TABLE t1 EXTENDED;
 
838
REPAIR TABLE t1 QUICK;
 
839
CHECK TABLE t1 EXTENDED;
 
840
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
 
841
SHOW TABLE STATUS LIKE 't1';
 
842
SELECT _id FROM t1;
 
843
DROP TABLE t1;
 
844
#
 
845
SET @@myisam_repair_threads=1;
 
846
SHOW VARIABLES LIKE 'myisam_repair%';
 
847
 
 
848
#
 
849
# BUG#21310 - Trees in SQL causing a "crashed" table with MyISAM storage
 
850
#             engine
 
851
#
 
852
 
 
853
# A simplified test case that reflect crashed table issue.
 
854
CREATE TABLE t1(a VARCHAR(16));
 
855
INSERT INTO t1 VALUES('aaaaaaaa'),(NULL);
 
856
UPDATE t1 AS ta1, t1 AS ta2 SET ta1.a='aaaaaaaaaaaaaaaa';
 
857
SELECT * FROM t1;
 
858
DROP TABLE t1;
 
859
 
 
860
# A test case that reflect wrong result set.
 
861
CREATE TABLE t1(a INT);
 
862
INSERT INTO t1 VALUES(1),(2);
 
863
UPDATE t1,t1 AS t2 SET t1.a=t1.a+2 WHERE t1.a=t2.a-1;
 
864
SELECT * FROM t1 ORDER BY a;
639
865
DROP TABLE t1;
640
866
 
641
867
#
642
868
# Bug#24607 - MyISAM pointer size determined incorrectly
643
869
#
644
 
CREATE TEMPORARY TABLE t1 (c1 TEXT) ENGINE=MyISAM;
645
 
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
646
 
show table status like 't1';
 
870
CREATE TABLE t1 (c1 TEXT) AVG_ROW_LENGTH=70100 MAX_ROWS=4100100100;
 
871
--replace_column 5 X 6 X 7 X 9 X 10 X 11 X 12 X 13 X 14 X 16 X
 
872
SHOW TABLE STATUS LIKE 't1';
647
873
DROP TABLE t1;
648
874
 
649
875
#
650
876
# Bug#26231 - select count(*) on myisam table returns wrong value
651
877
#             when index is used
652
878
#
653
 
CREATE TEMPORARY TABLE t1 (c1 TEXT NOT NULL, KEY c1 (c1(10))) ENGINE=MyISAM;
 
879
CREATE TABLE t1 (c1 TEXT NOT NULL, KEY c1 (c1(10))) ENGINE=MyISAM;
654
880
# Fill at least two key blocks. "Tab, A" must be in both blocks. 
655
881
INSERT INTO t1 VALUES
656
882
  (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
798
1024
 
799
1025
let $default=`select @@storage_engine`;
800
1026
set storage_engine=MyISAM;
801
 
let $temp= TEMPORARY;
802
1027
source include/varchar.inc;
803
1028
 
804
1029
#
805
1030
# Some errors/warnings on create
806
1031
#
807
1032
 
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));
 
1033
create table t1 (v varchar(65530), key(v));
 
1034
drop table if exists t1;
 
1035
create table t1 (v varchar(65536));
 
1036
show create table t1;
 
1037
drop table t1;
 
1038
create table t1 (v varchar(65530) character set utf8);
 
1039
show create table t1;
 
1040
drop table t1;
814
1041
 
815
1042
# MyISAM specific varchar tests
816
 
--error ER_TOO_BIG_FIELDLENGTH
817
 
create temporary table t1 (v varchar(65535));
 
1043
--error 1118
 
1044
create table t1 (v varchar(65535));
818
1045
 
819
1046
eval set storage_engine=$default;
820
1047
 
 
1048
#
 
1049
# Test concurrent insert
 
1050
# First with static record length
 
1051
#
 
1052
set @save_concurrent_insert=@@concurrent_insert;
 
1053
set global concurrent_insert=1;
 
1054
create table t1 (a int);
 
1055
insert into t1 values (1),(2),(3),(4),(5);
 
1056
lock table t1 read local;
 
1057
connect (con1,localhost,root,,);
 
1058
connection con1;
 
1059
# Insert in table without hole
 
1060
insert into t1 values(6),(7);
 
1061
connection default;
 
1062
unlock tables;
 
1063
delete from t1 where a>=3 and a<=4;
 
1064
lock table t1 read local;
 
1065
connection con1;
 
1066
set global concurrent_insert=2;
 
1067
# Insert in table with hole -> Should insert at end
 
1068
insert into t1 values (8),(9);
 
1069
connection default;
 
1070
unlock tables;
 
1071
# Insert into hole
 
1072
insert into t1 values (10),(11),(12);
 
1073
select * from t1;
 
1074
check table t1;
 
1075
drop table t1;
 
1076
disconnect con1;
 
1077
 
 
1078
# Same test with dynamic record length
 
1079
create table t1 (a int, b varchar(30) default "hello");
 
1080
insert into t1 (a) values (1),(2),(3),(4),(5);
 
1081
lock table t1 read local;
 
1082
connect (con1,localhost,root,,);
 
1083
connection con1;
 
1084
# Insert in table without hole
 
1085
insert into t1 (a) values(6),(7);
 
1086
connection default;
 
1087
unlock tables;
 
1088
delete from t1 where a>=3 and a<=4;
 
1089
lock table t1 read local;
 
1090
connection con1;
 
1091
set global concurrent_insert=2;
 
1092
# Insert in table with hole -> Should insert at end
 
1093
insert into t1 (a) values (8),(9);
 
1094
connection default;
 
1095
unlock tables;
 
1096
# Insert into hole
 
1097
insert into t1 (a) values (10),(11),(12);
 
1098
select a from t1;
 
1099
check table t1;
 
1100
drop table t1;
 
1101
disconnect con1;
 
1102
set global concurrent_insert=@save_concurrent_insert;
 
1103
 
821
1104
 
822
1105
# BUG#9622 - ANALYZE TABLE and ALTER TABLE .. ENABLE INDEX produce
823
1106
# different statistics on the same table with NULL values.
824
 
create temporary table t1 (a int, key(a)) engine=myisam;
 
1107
create table t1 (a int, key(a));
825
1108
 
826
1109
insert into t1 values (1),(2),(3),(4),(NULL),(NULL),(NULL),(NULL);
827
1110
analyze table t1;
835
1118
 
836
1119
 
837
1120
#
 
1121
# Bug#10056 - PACK_KEYS option take values greater than 1 while creating table
 
1122
#
 
1123
create table t1 (c1 int) engine=myisam pack_keys=0;
 
1124
create table t2 (c1 int) engine=myisam pack_keys=1;
 
1125
create table t3 (c1 int) engine=myisam pack_keys=default;
 
1126
--error 1064
 
1127
create table t4 (c1 int) engine=myisam pack_keys=2;
 
1128
drop table t1, t2, t3;
 
1129
 
 
1130
 
 
1131
#
838
1132
# Bug#28476: force index on a disabled myisam index gives error 124
839
1133
#
840
 
CREATE TEMPORARY TABLE t1(a INT, b INT, KEY inx (a), UNIQUE KEY uinx (b)) ENGINE=MyISAM;
 
1134
CREATE TABLE t1(a INT, b INT, KEY inx (a), UNIQUE KEY uinx (b)) ENGINE=MyISAM;
841
1135
INSERT INTO t1(a,b) VALUES (1,1),(2,2),(3,3),(4,4),(5,5);
842
1136
SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1;
843
1137
ALTER TABLE t1 DISABLE KEYS;
853
1147
#
854
1148
# Bug#4692 - DISABLE/ENABLE KEYS waste a space
855
1149
#
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';
 
1150
CREATE TABLE t1 (c1 INT, c2 INT, UNIQUE INDEX (c1), INDEX (c2)) ENGINE=MYISAM;
 
1151
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
 
1152
SHOW TABLE STATUS LIKE 't1';
859
1153
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';
 
1154
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
 
1155
SHOW TABLE STATUS LIKE 't1';
 
1156
ALTER TABLE t1 DISABLE KEYS;
 
1157
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
 
1158
SHOW TABLE STATUS LIKE 't1';
 
1159
ALTER TABLE t1 ENABLE KEYS;
 
1160
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
 
1161
SHOW TABLE STATUS LIKE 't1';
 
1162
ALTER TABLE t1 DISABLE KEYS;
 
1163
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
 
1164
SHOW TABLE STATUS LIKE 't1';
 
1165
ALTER TABLE t1 ENABLE KEYS;
 
1166
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
 
1167
SHOW TABLE STATUS LIKE 't1';
874
1168
#--exec ls -log var/master-data/test/t1.MYI
875
1169
#--exec myisamchk -dvv var/master-data/test/t1.MYI
876
1170
#--exec myisamchk -iev var/master-data/test/t1.MYI
877
1171
--echo # Enable keys with parallel repair
 
1172
SET @@myisam_repair_threads=2;
878
1173
ALTER TABLE t1 DISABLE KEYS;
879
1174
ALTER TABLE t1 ENABLE KEYS;
880
 
CHECK TABLE t1;
 
1175
SET @@myisam_repair_threads=1;
 
1176
CHECK TABLE t1 EXTENDED;
881
1177
DROP TABLE t1;
882
1178
 
883
1179
#
884
1180
# Bug#28837: MyISAM storage engine error (134) doing delete with self-join
885
1181
#
886
 
# DRIZZLE NOTE: Cannot self join on temp tables.
887
 
CREATE TABLE t1 (id int NOT NULL, ref int NOT NULL, INDEX (id));
 
1182
 
 
1183
CREATE TABLE t1 (id int NOT NULL, ref int NOT NULL, INDEX (id)) ENGINE=MyISAM;
888
1184
CREATE TABLE t2 LIKE t1;
889
1185
 
890
1186
INSERT INTO t2 (id, ref) VALUES (1,3), (2,1), (3,2), (4,5), (4,4);
892
1188
 
893
1189
SELECT * FROM t1 AS a INNER JOIN t1 AS b USING (id) WHERE a.ref < b.ref;
894
1190
SELECT * FROM t1;
 
1191
DELETE FROM a USING t1 AS a INNER JOIN t1 AS b USING (id) WHERE a.ref < b.ref;
 
1192
SELECT * FROM t1;
895
1193
 
896
1194
DROP TABLE t1, t2;
897
1195
 
899
1197
 
900
1198
 
901
1199
#
 
1200
# Test of key_block_size
 
1201
#
 
1202
 
 
1203
create table t1 (a int not null, key `a` (a) key_block_size=1024);
 
1204
show create table t1;
 
1205
drop table t1;
 
1206
 
 
1207
create table t1 (a int not null, key `a` (a) key_block_size=2048);
 
1208
show create table t1;
 
1209
drop table t1;
 
1210
 
 
1211
create table t1 (a varchar(2048), key `a` (a));
 
1212
show create table t1;
 
1213
drop table t1;
 
1214
 
 
1215
create table t1 (a varchar(2048), key `a` (a) key_block_size=1024);
 
1216
show create table t1;
 
1217
drop table t1;
 
1218
 
 
1219
create table t1 (a int not null, b varchar(2048), key (a), key(b)) key_block_size=1024;
 
1220
show create table t1;
 
1221
alter table t1 key_block_size=2048;
 
1222
show create table t1;
 
1223
alter table t1 add c int, add key (c);
 
1224
show create table t1;
 
1225
alter table t1 key_block_size=0;
 
1226
alter table t1 add d int, add key (d);
 
1227
show create table t1;
 
1228
drop table t1;
 
1229
 
 
1230
create table t1 (a int not null, b varchar(2048), key (a), key(b)) key_block_size=8192;
 
1231
show create table t1;
 
1232
drop table t1;
 
1233
 
 
1234
create table t1 (a int not null, b varchar(2048), key (a) key_block_size=1024, key(b)) key_block_size=8192;
 
1235
show create table t1;
 
1236
drop table t1;
 
1237
 
 
1238
create table t1 (a int not null, b int, key (a) key_block_size=1024, key(b) key_block_size=8192) key_block_size=16384;
 
1239
show create table t1;
 
1240
drop table t1;
 
1241
 
 
1242
 
 
1243
# Test limits and errors of key_block_size
 
1244
 
 
1245
create table t1 (a int not null, key `a` (a) key_block_size=512);
 
1246
show create table t1;
 
1247
drop table t1;
 
1248
 
 
1249
create table t1 (a varchar(2048), key `a` (a) key_block_size=1000000000000000000);
 
1250
show create table t1;
 
1251
drop table t1;
 
1252
 
 
1253
create table t1 (a int not null, key `a` (a) key_block_size=1025);
 
1254
show create table t1;
 
1255
drop table t1;
 
1256
 
 
1257
--error 1064
 
1258
create table t1 (a int not null, key key_block_size=1024 (a));
 
1259
--error 1064
 
1260
create table t1 (a int not null, key `a` key_block_size=1024 (a));
 
1261
 
 
1262
#
902
1263
# Bug#22119 - Changing MI_KEY_BLOCK_LENGTH makes a wrong myisamchk
903
1264
#
904
 
CREATE temporary TABLE t1 (
 
1265
CREATE TABLE t1 (
905
1266
  c1 INT,
906
1267
  c2 VARCHAR(300),
907
1268
  KEY (c1) KEY_BLOCK_SIZE 1024,
908
1269
  KEY (c2) KEY_BLOCK_SIZE 8192
909
 
  ) ENGINE=MyISAM;
 
1270
  );
910
1271
INSERT INTO t1 VALUES (10, REPEAT('a', CEIL(RAND(10) * 300))),
911
1272
  (11, REPEAT('b', CEIL(RAND() * 300))),
912
1273
  (12, REPEAT('c', CEIL(RAND() * 300))),
933
1294
  (33, REPEAT('x', CEIL(RAND() * 300))),
934
1295
  (34, REPEAT('y', CEIL(RAND() * 300))),
935
1296
  (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;
 
1297
INSERT INTO t1 SELECT * FROM t1;
 
1298
INSERT INTO t1 SELECT * FROM t1;
942
1299
CHECK TABLE t1;
 
1300
REPAIR TABLE t1;
943
1301
DELETE FROM t1 WHERE c1 >= 10;
944
1302
CHECK TABLE t1;
945
1303
DROP TABLE t1;
951
1309
# Test #1 - CHECK TABLE sees wrong record, REPAR TABLE deletes it.
952
1310
# Using a CHAR column that can have > 127 characters.
953
1311
# Using a VARCHAR to create a table with dynamic row format.
954
 
CREATE temporary TABLE t1 (
 
1312
CREATE TABLE t1 (
955
1313
  c1 CHAR(130),
956
1314
  c2 VARCHAR(1)
957
1315
) ENGINE=MyISAM;
958
1316
INSERT INTO t1 VALUES(REPEAT("a",128), 'b');
959
1317
SELECT COUNT(*) FROM t1;
960
1318
CHECK TABLE t1;
 
1319
REPAIR TABLE t1;
961
1320
SELECT COUNT(*) FROM t1;
962
1321
CHECK TABLE t1;
963
1322
DROP TABLE t1;
965
1324
# Test #2 - same as test #1, but using EXTENDED.
966
1325
# Using a CHAR column that can have > 127 characters.
967
1326
# Using a VARCHAR to create a table with dynamic row format.
968
 
CREATE temporary TABLE t1 (
 
1327
CREATE TABLE t1 (
969
1328
  c1 CHAR(130),
970
1329
  c2 VARCHAR(1)
971
1330
) ENGINE=MyISAM;
972
1331
INSERT INTO t1 VALUES(REPEAT("a",128), 'b');
973
1332
SELECT COUNT(*) FROM t1;
974
 
CHECK TABLE t1;
 
1333
CHECK TABLE t1 EXTENDED;
 
1334
REPAIR TABLE t1 EXTENDED;
975
1335
SELECT COUNT(*) FROM t1;
976
 
CHECK TABLE t1;
 
1336
CHECK TABLE t1 EXTENDED;
977
1337
DROP TABLE t1;
978
1338
#
979
1339
# Test #3 - same as test #1, but using OPTIMIZE TABLE.
980
1340
# Using a CHAR column that can have > 127 characters.
981
1341
# Using a VARCHAR to create a table with dynamic row format.
982
 
CREATE temporary TABLE t1 (
 
1342
CREATE TABLE t1 (
983
1343
  c1 CHAR(130),
984
1344
  c2 VARCHAR(1)
985
1345
) ENGINE=MyISAM;
989
1349
INSERT INTO t1 VALUES('c', 'b');
990
1350
DELETE FROM t1 WHERE c1='b';
991
1351
SELECT COUNT(*) FROM t1;
992
 
ALTER TABLE t1 ENGINE=MyISAM;
 
1352
OPTIMIZE TABLE t1;
993
1353
SELECT COUNT(*) FROM t1;
994
1354
DROP TABLE t1;
995
1355
#
997
1357
# Using a CHAR column that can have > 127 characters.
998
1358
# Using a VARCHAR to create a table with dynamic row format.
999
1359
# Using an index which can be disabled during bulk insert.
1000
 
CREATE temporary TABLE t1 (
 
1360
CREATE TABLE t1 (
1001
1361
  c1 CHAR(130),
1002
1362
  c2 VARCHAR(1),
1003
1363
  KEY (c1)
1024
1384
# With bug present, this shows that all long rows are gone.
1025
1385
SELECT COUNT(*) FROM t1;
1026
1386
CHECK TABLE t1;
1027
 
CHECK TABLE t1;
 
1387
CHECK TABLE t1 EXTENDED;
1028
1388
DROP TABLE t1;
1029
1389
#
1030
1390
# Test #5 - same as test #1 but UTF-8.
1031
1391
# Using a CHAR column that can have > 127 characters.
1032
1392
# Using a VARCHAR to create a table with dynamic row format.
1033
 
CREATE temporary TABLE t1 (
 
1393
CREATE TABLE t1 (
1034
1394
  c1 CHAR(50),
1035
1395
  c2 VARCHAR(1)
1036
 
) ENGINE=MyISAM;
 
1396
) ENGINE=MyISAM DEFAULT CHARSET UTF8;
1037
1397
# Using Tamil Letter A, Unicode U+0B85
1038
 
INSERT INTO t1 VALUES(REPEAT( x'e0ae85',43), 'b');
 
1398
INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b');
1039
1399
SELECT COUNT(*) FROM t1;
1040
1400
CHECK TABLE t1;
 
1401
REPAIR TABLE t1;
1041
1402
SELECT COUNT(*) FROM t1;
1042
1403
CHECK TABLE t1;
1043
1404
DROP TABLE t1;
1045
1406
# Test #6 - same as test #2, but UTF-8.
1046
1407
# Using a CHAR column that can have > 127 characters.
1047
1408
# Using a VARCHAR to create a table with dynamic row format.
1048
 
CREATE temporary TABLE t1 (
 
1409
CREATE TABLE t1 (
1049
1410
  c1 CHAR(50),
1050
1411
  c2 VARCHAR(1)
1051
 
) ENGINE=MyISAM;
 
1412
) ENGINE=MyISAM DEFAULT CHARSET UTF8;
1052
1413
# Using Tamil Letter A, Unicode U+0B85
1053
 
INSERT INTO t1 VALUES(REPEAT( x'e0ae85',43), 'b');
1054
 
SELECT COUNT(*) FROM t1;
1055
 
CHECK TABLE t1;
1056
 
SELECT COUNT(*) FROM t1;
1057
 
CHECK TABLE t1;
 
1414
INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b');
 
1415
SELECT COUNT(*) FROM t1;
 
1416
CHECK TABLE t1 EXTENDED;
 
1417
REPAIR TABLE t1 EXTENDED;
 
1418
SELECT COUNT(*) FROM t1;
 
1419
CHECK TABLE t1 EXTENDED;
1058
1420
DROP TABLE t1;
1059
1421
#
1060
1422
# Test #7 - same as test #3, but UTF-8.
1061
1423
# Using a CHAR column that can have > 127 characters.
1062
1424
# Using a VARCHAR to create a table with dynamic row format.
1063
 
CREATE temporary TABLE t1 (
 
1425
CREATE TABLE t1 (
1064
1426
  c1 CHAR(50),
1065
1427
  c2 VARCHAR(1)
1066
 
) ENGINE=MyISAM;
 
1428
) ENGINE=MyISAM DEFAULT CHARSET UTF8;
1067
1429
# Using Tamil Letter A, Unicode U+0B85
1068
 
INSERT INTO t1 VALUES(REPEAT( x'e0ae85',43), 'b');
 
1430
INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b');
1069
1431
# Insert more rows and delete one in the middle to force optimize.
1070
1432
INSERT INTO t1 VALUES('b', 'b');
1071
1433
INSERT INTO t1 VALUES('c', 'b');
1072
1434
DELETE FROM t1 WHERE c1='b';
1073
1435
SELECT COUNT(*) FROM t1;
1074
 
ALTER TABLE t1 ENGINE=MyISAM;
 
1436
OPTIMIZE TABLE t1;
1075
1437
SELECT COUNT(*) FROM t1;
1076
1438
DROP TABLE t1;
1077
1439
#
1079
1441
# Using a CHAR column that can have > 42 UTF-8 characters.
1080
1442
# Using a VARCHAR to create a table with dynamic row format.
1081
1443
# Using an index which can be disabled during bulk insert.
1082
 
CREATE temporary TABLE t1 (
 
1444
CREATE TABLE t1 (
1083
1445
  c1 CHAR(50),
1084
1446
  c2 VARCHAR(1),
1085
1447
  KEY (c1)
1086
 
) ENGINE=MyISAM;
 
1448
) ENGINE=MyISAM DEFAULT CHARSET UTF8;
1087
1449
#
1088
1450
# Insert 100 rows. This turns bulk insert on during the copy phase of
1089
1451
# ALTER TABLE. Bulk insert disables keys before the insert and re-enables
1100
1462
#
1101
1463
# Change most of the rows into long character values with > 42 characters.
1102
1464
# Using Tamil Letter A, Unicode U+0B85
1103
 
UPDATE t1 SET c1=REPEAT( x'e0ae85',43) LIMIT 90;
 
1465
UPDATE t1 SET c1=REPEAT(_utf8 x'e0ae85',43) LIMIT 90;
1104
1466
SELECT COUNT(*) FROM t1;
1105
1467
ALTER TABLE t1 ENGINE=MyISAM;
1106
1468
#
1107
1469
# With bug present, this shows that all long rows are gone.
1108
1470
SELECT COUNT(*) FROM t1;
1109
1471
CHECK TABLE t1;
1110
 
CHECK TABLE t1;
1111
 
DROP TABLE t1;
 
1472
CHECK TABLE t1 EXTENDED;
 
1473
DROP TABLE t1;
 
1474
 
 
1475
#
 
1476
# Bug#29182 - MyISAMCHK reports wrong character set
 
1477
#
 
1478
CREATE TABLE t1 (
 
1479
  c1 VARCHAR(10) NOT NULL,
 
1480
  c2 CHAR(10) DEFAULT NULL,
 
1481
  c3 VARCHAR(10) NOT NULL,
 
1482
  KEY (c1),
 
1483
  KEY (c2)
 
1484
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;
 
1485
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
1486
--exec $MYISAMCHK -d $MYSQLTEST_VARDIR/master-data/test/t1
 
1487
DROP TABLE t1;
 
1488
 
1112
1489
--echo End of 5.1 tests
1113
1490