~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/myisam.test

  • Committer: Monty Taylor
  • Date: 2009-02-08 10:59:43 UTC
  • mto: This revision was merged to the branch mainline in revision 852.
  • Revision ID: mordred@inaugust.com-20090208105943-e30tagctq2nrghxi
Renamed my_net_* to drizzleclient_net_* to help with namespace issues.

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
 
  `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)) 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,
 
700
  time TIME NOT NULL,
554
701
  score INT NOT NULL DEFAULT 0,
555
702
  bob TINYBLOB
556
 
) engine=myisam;
 
703
);
557
704
 
558
 
insert into t1 (cip) VALUES (1), (2), (3);
559
 
insert into t1 (cip, bob) VALUES (4, 'a' ), (5, 'b'), 
560
 
                                       (6, 'c');
 
705
insert into t1 (cip, time) VALUES (1, '00:01'), (2, '00:02'), (3,'00:03');
 
706
insert into t1 (cip, bob, time) VALUES (4, 'a', '00:04'), (5, 'b', '00:05'), 
 
707
                                       (6, 'c', '00:06');
561
708
select * from t1 where bob is null and cip=1;
562
 
create index bug on t1 (bob(22), cip);
 
709
create index bug on t1 (bob(22), cip, time);
563
710
select * from t1 where bob is null and cip=1;
564
711
drop table t1;
565
712
 
566
713
#
567
714
# Bug#14980 - COUNT(*) incorrect on MyISAM table with certain INDEX
568
715
#
569
 
create temporary table t1 (
 
716
create table t1 (
570
717
  id1 int not null auto_increment,
571
718
  id2 int not null default '0',
572
719
  t text not null,
585
732
# BUG##20357 - Got error 124 from storage engine using MIN and MAX functions
586
733
#              in queries
587
734
#
588
 
CREATE TEMPORARY TABLE t1(a int, KEY(a)) ENGINE=MyISAM;
 
735
CREATE TABLE t1(a int, KEY(a)) ENGINE=MyISAM;
589
736
INSERT INTO t1 VALUES(1);
590
737
SELECT MAX(a) FROM t1 IGNORE INDEX(a);
591
738
ALTER TABLE t1 DISABLE KEYS;
594
741
DROP TABLE t1;
595
742
 
596
743
#
 
744
# BUG#18036 - update of table joined to self reports table as crashed
 
745
#
 
746
CREATE TABLE t1(a CHAR(9), b VARCHAR(7)) ENGINE=MyISAM;
 
747
INSERT INTO t1(a) VALUES('xxxxxxxxx'),('xxxxxxxxx');
 
748
UPDATE t1 AS ta1,t1 AS ta2 SET ta1.b='aaaaaa',ta2.b='bbbbbb';
 
749
SELECT * FROM t1;
 
750
DROP TABLE t1;
 
751
 
 
752
#
597
753
# Bug#8283 - OPTIMIZE TABLE causes data loss
598
754
#
 
755
SET GLOBAL myisam_repair_threads=2;
 
756
SHOW VARIABLES LIKE 'myisam_repair%';
 
757
#
599
758
# 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;
 
759
CREATE TABLE t1 (
 
760
  `_id` int NOT NULL default '0',
 
761
  `url` text,
 
762
  `email` text,
 
763
  `description` text,
 
764
  `loverlap` int default NULL,
 
765
  `roverlap` int default NULL,
 
766
  `lneighbor_id` int default NULL,
 
767
  `rneighbor_id` int default NULL,
 
768
  `length_` int default NULL,
 
769
  `sequence` text,
 
770
  `name` text,
 
771
  `_obj_class` text NOT NULL,
 
772
  PRIMARY KEY  (`_id`),
 
773
  UNIQUE KEY `sequence_name_index` (`name`(50)),
 
774
  KEY (`length_`)
 
775
) ENGINE=MyISAM;
 
776
 
 
777
INSERT INTO t1 VALUES
 
778
  (1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample1',''),
 
779
  (2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample2',''),
 
780
  (3,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample3',''),
 
781
  (4,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample4',''),
 
782
  (5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample5',''),
 
783
  (6,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample6',''),
 
784
  (7,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample7',''),
 
785
  (8,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample8',''),
 
786
  (9,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample9','');
 
787
#
 
788
SELECT _id FROM t1;
 
789
DELETE FROM t1 WHERE _id < 8;
 
790
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
 
791
SHOW TABLE STATUS LIKE 't1';
 
792
CHECK TABLE t1 EXTENDED;
 
793
OPTIMIZE TABLE t1;
 
794
CHECK TABLE t1 EXTENDED;
 
795
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
 
796
SHOW TABLE STATUS LIKE 't1';
 
797
SELECT _id FROM t1;
 
798
DROP TABLE t1;
 
799
#
 
800
# Test REPAIR QUICK. This retains the old data file.
 
801
CREATE TABLE t1 (
 
802
  `_id` int NOT NULL default '0',
 
803
  `url` text,
 
804
  `email` text,
 
805
  `description` text,
 
806
  `loverlap` int default NULL,
 
807
  `roverlap` int default NULL,
 
808
  `lneighbor_id` int default NULL,
 
809
  `rneighbor_id` int default NULL,
 
810
  `length_` int default NULL,
 
811
  `sequence` text,
 
812
  `name` text,
 
813
  `_obj_class` text NOT NULL,
 
814
  PRIMARY KEY  (`_id`),
 
815
  UNIQUE KEY `sequence_name_index` (`name`(50)),
 
816
  KEY (`length_`)
 
817
) ENGINE=MyISAM;
 
818
 
 
819
INSERT INTO t1 VALUES
 
820
  (1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample1',''),
 
821
  (2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample2',''),
 
822
  (3,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample3',''),
 
823
  (4,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample4',''),
 
824
  (5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample5',''),
 
825
  (6,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample6',''),
 
826
  (7,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample7',''),
 
827
  (8,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample8',''),
 
828
  (9,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample9','');
 
829
#
 
830
SELECT _id FROM t1;
 
831
DELETE FROM t1 WHERE _id < 8;
 
832
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
 
833
SHOW TABLE STATUS LIKE 't1';
 
834
CHECK TABLE t1 EXTENDED;
 
835
REPAIR TABLE t1 QUICK;
 
836
CHECK TABLE t1 EXTENDED;
 
837
--replace_column 6 # 7 # 8 # 9 # 11 # 12 # 13 # 14 # 15 # 16 #
 
838
SHOW TABLE STATUS LIKE 't1';
 
839
SELECT _id FROM t1;
 
840
DROP TABLE t1;
 
841
#
 
842
SET GLOBAL myisam_repair_threads=1;
 
843
SHOW VARIABLES LIKE 'myisam_repair%';
 
844
 
 
845
#
 
846
# BUG#21310 - Trees in SQL causing a "crashed" table with MyISAM storage
 
847
#             engine
 
848
#
 
849
 
 
850
# A simplified test case that reflect crashed table issue.
 
851
CREATE TABLE t1(a VARCHAR(16)) ENGINE=MyISAM;
 
852
INSERT INTO t1 VALUES('aaaaaaaa'),(NULL);
 
853
UPDATE t1 AS ta1, t1 AS ta2 SET ta1.a='aaaaaaaaaaaaaaaa';
 
854
SELECT * FROM t1;
 
855
DROP TABLE t1;
 
856
 
 
857
# A test case that reflect wrong result set.
 
858
CREATE TABLE t1(a INT) ENGINE=MyISAM;
 
859
INSERT INTO t1 VALUES(1),(2);
 
860
UPDATE t1,t1 AS t2 SET t1.a=t1.a+2 WHERE t1.a=t2.a-1;
 
861
SELECT * FROM t1 ORDER BY a;
639
862
DROP TABLE t1;
640
863
 
641
864
#
642
865
# Bug#24607 - MyISAM pointer size determined incorrectly
643
866
#
644
 
CREATE TEMPORARY TABLE t1 (c1 TEXT) ENGINE=MyISAM;
645
 
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
646
 
show table status like 't1';
 
867
CREATE TABLE t1 (c1 TEXT) ENGINE=MyISAM AVG_ROW_LENGTH=70100 MAX_ROWS=4100100100;
 
868
--replace_column 5 X 6 X 7 X 9 X 10 X 11 X 12 X 13 X 14 X 16 X
 
869
SHOW TABLE STATUS LIKE 't1';
647
870
DROP TABLE t1;
648
871
 
649
872
#
650
873
# Bug#26231 - select count(*) on myisam table returns wrong value
651
874
#             when index is used
652
875
#
653
 
CREATE TEMPORARY TABLE t1 (c1 TEXT NOT NULL, KEY c1 (c1(10))) ENGINE=MyISAM;
 
876
CREATE TABLE t1 (c1 TEXT NOT NULL, KEY c1 (c1(10))) ENGINE=MyISAM;
654
877
# Fill at least two key blocks. "Tab, A" must be in both blocks. 
655
878
INSERT INTO t1 VALUES
656
879
  (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
798
1021
 
799
1022
let $default=`select @@storage_engine`;
800
1023
set storage_engine=MyISAM;
801
 
let $temp= TEMPORARY;
802
1024
source include/varchar.inc;
803
1025
 
804
1026
#
805
1027
# Some errors/warnings on create
806
1028
#
807
1029
 
808
 
--error ER_TOO_BIG_FIELDLENGTH
809
 
create temporary table t1 (v varchar(65530), key(v));
810
 
--error ER_TOO_BIG_FIELDLENGTH
811
 
create temporary table t1 (v varchar(65536));
812
 
--error ER_TOO_BIG_FIELDLENGTH
813
 
create temporary table t1 (v varchar(65530));
 
1030
--error 1074
 
1031
create table t1 (v varchar(65530), key(v));
 
1032
--error 1074
 
1033
create table t1 (v varchar(65536));
 
1034
--error 1074
 
1035
create table t1 (v varchar(65530));
814
1036
 
815
1037
# MyISAM specific varchar tests
816
 
--error ER_TOO_BIG_FIELDLENGTH
817
 
create temporary table t1 (v varchar(65535));
 
1038
--error 1074
 
1039
create table t1 (v varchar(65535));
818
1040
 
819
1041
eval set storage_engine=$default;
820
1042
 
 
1043
#
 
1044
# Test concurrent insert
 
1045
# First with static record length
 
1046
#
 
1047
#@TODO The below test fails with unknown system variable
 
1048
#      concurrent_insert
 
1049
#
 
1050
#set @save_concurrent_insert=@@concurrent_insert;
 
1051
#set global concurrent_insert=1;
 
1052
#create table t1 (a int);
 
1053
#insert into t1 values (1),(2),(3),(4),(5);
 
1054
#lock table t1 read local;
 
1055
#connect (con1,localhost,root,,);
 
1056
#connection con1;
 
1057
# Insert in table without hole
 
1058
#insert into t1 values(6),(7);
 
1059
#connection default;
 
1060
#unlock tables;
 
1061
#delete from t1 where a>=3 and a<=4;
 
1062
#lock table t1 read local;
 
1063
#connection con1;
 
1064
#set global concurrent_insert=2;
 
1065
# Insert in table with hole -> Should insert at end
 
1066
#insert into t1 values (8),(9);
 
1067
#connection default;
 
1068
#unlock tables;
 
1069
# Insert into hole
 
1070
#insert into t1 values (10),(11),(12);
 
1071
#select * from t1;
 
1072
#check table t1;
 
1073
#drop table t1;
 
1074
#disconnect con1;
 
1075
 
 
1076
# Same test with dynamic record length
 
1077
#create table t1 (a int, b varchar(30) default "hello");
 
1078
#insert into t1 (a) values (1),(2),(3),(4),(5);
 
1079
#lock table t1 read local;
 
1080
#connect (con1,localhost,root,,);
 
1081
#connection con1;
 
1082
# Insert in table without hole
 
1083
#insert into t1 (a) values(6),(7);
 
1084
#connection default;
 
1085
#unlock tables;
 
1086
#delete from t1 where a>=3 and a<=4;
 
1087
#lock table t1 read local;
 
1088
#connection con1;
 
1089
#set global concurrent_insert=2;
 
1090
## Insert in table with hole -> Should insert at end
 
1091
#insert into t1 (a) values (8),(9);
 
1092
#connection default;
 
1093
#unlock tables;
 
1094
# Insert into hole
 
1095
#insert into t1 (a) values (10),(11),(12);
 
1096
#select a from t1;
 
1097
#check table t1;
 
1098
#drop table t1;
 
1099
#disconnect con1;
 
1100
#set global concurrent_insert=@save_concurrent_insert;
 
1101
 
821
1102
 
822
1103
# BUG#9622 - ANALYZE TABLE and ALTER TABLE .. ENABLE INDEX produce
823
1104
# different statistics on the same table with NULL values.
824
 
create temporary table t1 (a int, key(a)) engine=myisam;
 
1105
create table t1 (a int, key(a));
825
1106
 
826
1107
insert into t1 values (1),(2),(3),(4),(NULL),(NULL),(NULL),(NULL);
827
1108
analyze table t1;
835
1116
 
836
1117
 
837
1118
#
 
1119
# Bug#10056 - PACK_KEYS option take values greater than 1 while creating table
 
1120
#
 
1121
create table t1 (c1 int) engine=myisam pack_keys=0;
 
1122
create table t2 (c1 int) engine=myisam pack_keys=1;
 
1123
create table t3 (c1 int) engine=myisam pack_keys=default;
 
1124
--error 1064
 
1125
create table t4 (c1 int) engine=myisam pack_keys=2;
 
1126
drop table t1, t2, t3;
 
1127
 
 
1128
 
 
1129
#
838
1130
# Bug#28476: force index on a disabled myisam index gives error 124
839
1131
#
840
 
CREATE TEMPORARY TABLE t1(a INT, b INT, KEY inx (a), UNIQUE KEY uinx (b)) ENGINE=MyISAM;
 
1132
CREATE TABLE t1(a INT, b INT, KEY inx (a), UNIQUE KEY uinx (b)) ENGINE=MyISAM;
841
1133
INSERT INTO t1(a,b) VALUES (1,1),(2,2),(3,3),(4,4),(5,5);
842
1134
SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1;
843
1135
ALTER TABLE t1 DISABLE KEYS;
853
1145
#
854
1146
# Bug#4692 - DISABLE/ENABLE KEYS waste a space
855
1147
#
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';
 
1148
CREATE TABLE t1 (c1 INT, c2 INT, UNIQUE INDEX (c1), INDEX (c2)) ENGINE=MYISAM;
 
1149
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
 
1150
SHOW TABLE STATUS LIKE 't1';
859
1151
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';
 
1152
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
 
1153
SHOW TABLE STATUS LIKE 't1';
 
1154
ALTER TABLE t1 DISABLE KEYS;
 
1155
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
 
1156
SHOW TABLE STATUS LIKE 't1';
 
1157
ALTER TABLE t1 ENABLE KEYS;
 
1158
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
 
1159
SHOW TABLE STATUS LIKE 't1';
 
1160
ALTER TABLE t1 DISABLE KEYS;
 
1161
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
 
1162
SHOW TABLE STATUS LIKE 't1';
 
1163
ALTER TABLE t1 ENABLE KEYS;
 
1164
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
 
1165
SHOW TABLE STATUS LIKE 't1';
874
1166
#--exec ls -log var/master-data/test/t1.MYI
875
1167
#--exec myisamchk -dvv var/master-data/test/t1.MYI
876
1168
#--exec myisamchk -iev var/master-data/test/t1.MYI
877
1169
--echo # Enable keys with parallel repair
 
1170
SET GLOBAL myisam_repair_threads=2;
878
1171
ALTER TABLE t1 DISABLE KEYS;
879
1172
ALTER TABLE t1 ENABLE KEYS;
880
 
CHECK TABLE t1;
 
1173
SET GLOBAL myisam_repair_threads=1;
 
1174
CHECK TABLE t1 EXTENDED;
881
1175
DROP TABLE t1;
882
1176
 
883
1177
#
884
1178
# Bug#28837: MyISAM storage engine error (134) doing delete with self-join
885
1179
#
886
 
# DRIZZLE NOTE: Cannot self join on temp tables.
887
 
CREATE TABLE t1 (id int NOT NULL, ref int NOT NULL, INDEX (id));
 
1180
 
 
1181
CREATE TABLE t1 (id int NOT NULL, ref int NOT NULL, INDEX (id)) ENGINE=MyISAM;
888
1182
CREATE TABLE t2 LIKE t1;
889
1183
 
890
1184
INSERT INTO t2 (id, ref) VALUES (1,3), (2,1), (3,2), (4,5), (4,4);
892
1186
 
893
1187
SELECT * FROM t1 AS a INNER JOIN t1 AS b USING (id) WHERE a.ref < b.ref;
894
1188
SELECT * FROM t1;
 
1189
DELETE FROM a USING t1 AS a INNER JOIN t1 AS b USING (id) WHERE a.ref < b.ref;
 
1190
SELECT * FROM t1;
895
1191
 
896
1192
DROP TABLE t1, t2;
897
1193
 
899
1195
 
900
1196
 
901
1197
#
 
1198
# Test of key_block_size
 
1199
#
 
1200
 
 
1201
create table t1 (a int not null, key `a` (a) key_block_size=1024) ENGINE=MyISAM;
 
1202
show create table t1;
 
1203
drop table t1;
 
1204
 
 
1205
create table t1 (a int not null, key `a` (a) key_block_size=2048) ENGINE=MyISAM;
 
1206
show create table t1;
 
1207
drop table t1;
 
1208
 
 
1209
create table t1 (a varchar(2048), key `a` (a)) ENGINE=MyISAM;
 
1210
show create table t1;
 
1211
drop table t1;
 
1212
 
 
1213
create table t1 (a varchar(2048), key `a` (a) key_block_size=1024) ENGINE=MyISAM;
 
1214
show create table t1;
 
1215
drop table t1;
 
1216
 
 
1217
create table t1 (a int not null, b varchar(2048), key (a), key(b)) ENGINE=MyISAM key_block_size=1024;
 
1218
show create table t1;
 
1219
alter table t1 key_block_size=2048;
 
1220
show create table t1;
 
1221
alter table t1 add c int, add key (c);
 
1222
show create table t1;
 
1223
alter table t1 key_block_size=0;
 
1224
alter table t1 add d int, add key (d);
 
1225
show create table t1;
 
1226
drop table t1;
 
1227
 
 
1228
create table t1 (a int not null, b varchar(2048), key (a), key(b)) ENGINE=MyISAM key_block_size=8192;
 
1229
show create table t1;
 
1230
drop table t1;
 
1231
 
 
1232
create table t1 (a int not null, b varchar(2048), key (a) key_block_size=1024, key(b)) ENGINE=MyISAM key_block_size=8192;
 
1233
show create table t1;
 
1234
drop table t1;
 
1235
 
 
1236
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;
 
1237
show create table t1;
 
1238
drop table t1;
 
1239
 
 
1240
 
 
1241
# Test limits and errors of key_block_size
 
1242
 
 
1243
create table t1 (a int not null, key `a` (a) key_block_size=512) ENGINE=MyISAM;
 
1244
show create table t1;
 
1245
drop table t1;
 
1246
 
 
1247
create table t1 (a varchar(2048), key `a` (a) key_block_size=1000000000000000000) ENGINE=MyISAM;
 
1248
show create table t1;
 
1249
drop table t1;
 
1250
 
 
1251
create table t1 (a int not null, key `a` (a) key_block_size=1025) ENGINE=MyISAM;
 
1252
show create table t1;
 
1253
drop table t1;
 
1254
 
 
1255
--error 1064
 
1256
create table t1 (a int not null, key key_block_size=1024 (a)) ENGINE=MyISAM;
 
1257
--error 1064
 
1258
create table t1 (a int not null, key `a` key_block_size=1024 (a)) ENGINE=MyISAM;
 
1259
 
 
1260
#
902
1261
# Bug#22119 - Changing MI_KEY_BLOCK_LENGTH makes a wrong myisamchk
903
1262
#
904
 
CREATE temporary TABLE t1 (
 
1263
CREATE TABLE t1 (
905
1264
  c1 INT,
906
1265
  c2 VARCHAR(300),
907
1266
  KEY (c1) KEY_BLOCK_SIZE 1024,
933
1292
  (33, REPEAT('x', CEIL(RAND() * 300))),
934
1293
  (34, REPEAT('y', CEIL(RAND() * 300))),
935
1294
  (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;
 
1295
INSERT INTO t1 SELECT * FROM t1;
 
1296
INSERT INTO t1 SELECT * FROM t1;
942
1297
CHECK TABLE t1;
 
1298
REPAIR TABLE t1;
943
1299
DELETE FROM t1 WHERE c1 >= 10;
944
1300
CHECK TABLE t1;
945
1301
DROP TABLE t1;
951
1307
# Test #1 - CHECK TABLE sees wrong record, REPAR TABLE deletes it.
952
1308
# Using a CHAR column that can have > 127 characters.
953
1309
# Using a VARCHAR to create a table with dynamic row format.
954
 
CREATE temporary TABLE t1 (
 
1310
CREATE TABLE t1 (
955
1311
  c1 CHAR(130),
956
1312
  c2 VARCHAR(1)
957
1313
) ENGINE=MyISAM;
958
1314
INSERT INTO t1 VALUES(REPEAT("a",128), 'b');
959
1315
SELECT COUNT(*) FROM t1;
960
1316
CHECK TABLE t1;
 
1317
REPAIR TABLE t1;
961
1318
SELECT COUNT(*) FROM t1;
962
1319
CHECK TABLE t1;
963
1320
DROP TABLE t1;
965
1322
# Test #2 - same as test #1, but using EXTENDED.
966
1323
# Using a CHAR column that can have > 127 characters.
967
1324
# Using a VARCHAR to create a table with dynamic row format.
968
 
CREATE temporary TABLE t1 (
 
1325
CREATE TABLE t1 (
969
1326
  c1 CHAR(130),
970
1327
  c2 VARCHAR(1)
971
1328
) ENGINE=MyISAM;
972
1329
INSERT INTO t1 VALUES(REPEAT("a",128), 'b');
973
1330
SELECT COUNT(*) FROM t1;
974
 
CHECK TABLE t1;
 
1331
CHECK TABLE t1 EXTENDED;
 
1332
REPAIR TABLE t1 EXTENDED;
975
1333
SELECT COUNT(*) FROM t1;
976
 
CHECK TABLE t1;
 
1334
CHECK TABLE t1 EXTENDED;
977
1335
DROP TABLE t1;
978
1336
#
979
1337
# Test #3 - same as test #1, but using OPTIMIZE TABLE.
980
1338
# Using a CHAR column that can have > 127 characters.
981
1339
# Using a VARCHAR to create a table with dynamic row format.
982
 
CREATE temporary TABLE t1 (
 
1340
CREATE TABLE t1 (
983
1341
  c1 CHAR(130),
984
1342
  c2 VARCHAR(1)
985
1343
) ENGINE=MyISAM;
989
1347
INSERT INTO t1 VALUES('c', 'b');
990
1348
DELETE FROM t1 WHERE c1='b';
991
1349
SELECT COUNT(*) FROM t1;
992
 
ALTER TABLE t1 ENGINE=MyISAM;
 
1350
OPTIMIZE TABLE t1;
993
1351
SELECT COUNT(*) FROM t1;
994
1352
DROP TABLE t1;
995
1353
#
997
1355
# Using a CHAR column that can have > 127 characters.
998
1356
# Using a VARCHAR to create a table with dynamic row format.
999
1357
# Using an index which can be disabled during bulk insert.
1000
 
CREATE temporary TABLE t1 (
 
1358
CREATE TABLE t1 (
1001
1359
  c1 CHAR(130),
1002
1360
  c2 VARCHAR(1),
1003
1361
  KEY (c1)
1024
1382
# With bug present, this shows that all long rows are gone.
1025
1383
SELECT COUNT(*) FROM t1;
1026
1384
CHECK TABLE t1;
1027
 
CHECK TABLE t1;
 
1385
CHECK TABLE t1 EXTENDED;
1028
1386
DROP TABLE t1;
1029
1387
#
1030
1388
# Test #5 - same as test #1 but UTF-8.
1031
1389
# Using a CHAR column that can have > 127 characters.
1032
1390
# Using a VARCHAR to create a table with dynamic row format.
1033
 
CREATE temporary TABLE t1 (
 
1391
CREATE TABLE t1 (
1034
1392
  c1 CHAR(50),
1035
1393
  c2 VARCHAR(1)
1036
1394
) ENGINE=MyISAM;
1038
1396
INSERT INTO t1 VALUES(REPEAT( x'e0ae85',43), 'b');
1039
1397
SELECT COUNT(*) FROM t1;
1040
1398
CHECK TABLE t1;
 
1399
REPAIR TABLE t1;
1041
1400
SELECT COUNT(*) FROM t1;
1042
1401
CHECK TABLE t1;
1043
1402
DROP TABLE t1;
1045
1404
# Test #6 - same as test #2, but UTF-8.
1046
1405
# Using a CHAR column that can have > 127 characters.
1047
1406
# Using a VARCHAR to create a table with dynamic row format.
1048
 
CREATE temporary TABLE t1 (
 
1407
CREATE TABLE t1 (
1049
1408
  c1 CHAR(50),
1050
1409
  c2 VARCHAR(1)
1051
1410
) ENGINE=MyISAM;
1052
1411
# Using Tamil Letter A, Unicode U+0B85
1053
1412
INSERT INTO t1 VALUES(REPEAT( x'e0ae85',43), 'b');
1054
1413
SELECT COUNT(*) FROM t1;
1055
 
CHECK TABLE t1;
 
1414
CHECK TABLE t1 EXTENDED;
 
1415
REPAIR TABLE t1 EXTENDED;
1056
1416
SELECT COUNT(*) FROM t1;
1057
 
CHECK TABLE t1;
 
1417
CHECK TABLE t1 EXTENDED;
1058
1418
DROP TABLE t1;
1059
1419
#
1060
1420
# Test #7 - same as test #3, but UTF-8.
1061
1421
# Using a CHAR column that can have > 127 characters.
1062
1422
# Using a VARCHAR to create a table with dynamic row format.
1063
 
CREATE temporary TABLE t1 (
 
1423
CREATE TABLE t1 (
1064
1424
  c1 CHAR(50),
1065
1425
  c2 VARCHAR(1)
1066
1426
) ENGINE=MyISAM;
1071
1431
INSERT INTO t1 VALUES('c', 'b');
1072
1432
DELETE FROM t1 WHERE c1='b';
1073
1433
SELECT COUNT(*) FROM t1;
1074
 
ALTER TABLE t1 ENGINE=MyISAM;
 
1434
OPTIMIZE TABLE t1;
1075
1435
SELECT COUNT(*) FROM t1;
1076
1436
DROP TABLE t1;
1077
1437
#
1079
1439
# Using a CHAR column that can have > 42 UTF-8 characters.
1080
1440
# Using a VARCHAR to create a table with dynamic row format.
1081
1441
# Using an index which can be disabled during bulk insert.
1082
 
CREATE temporary TABLE t1 (
 
1442
CREATE TABLE t1 (
1083
1443
  c1 CHAR(50),
1084
1444
  c2 VARCHAR(1),
1085
1445
  KEY (c1)
1107
1467
# With bug present, this shows that all long rows are gone.
1108
1468
SELECT COUNT(*) FROM t1;
1109
1469
CHECK TABLE t1;
1110
 
CHECK TABLE t1;
 
1470
CHECK TABLE t1 EXTENDED;
1111
1471
DROP TABLE t1;
 
1472
 
 
1473
#
 
1474
# Bug#29182 - MyISAMCHK reports wrong character set
 
1475
#
 
1476
#@TODO Disabling the below, as no myisamcheck program
 
1477
#CREATE TABLE t1 (
 
1478
#  c1 VARCHAR(10) NOT NULL,
 
1479
#  c2 CHAR(10) DEFAULT NULL,
 
1480
#  c3 VARCHAR(10) NOT NULL,
 
1481
#  KEY (c1),
 
1482
#  KEY (c2)
 
1483
#) ENGINE=MyISAM PACK_KEYS=0;
 
1484
#--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
1485
#--exec $DRIZZLECHK -d $MYSQLTEST_VARDIR/master-data/test/t1
 
1486
#DROP TABLE t1;
 
1487
#
1112
1488
--echo End of 5.1 tests
1113
1489