~drizzle-pbxt/drizzle/drizzle-pbxt-2

« back to all changes in this revision

Viewing changes to tests/t/myisam.test

  • Committer: Paul McCullagh
  • Date: 2009-11-10 14:18:39 UTC
  • mfrom: (1038.1.7 drizzle-pbxt-pre-merge)
  • Revision ID: paul.mccullagh@primebase.org-20091110141839-2j3k43b17ag6f605
Merged Drizzle trunk and PBXT 1.0.09

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 TABLE t1 (
 
15
CREATE TEMPORARY TABLE t1 (
16
16
  STRING_DATA char(255) default NULL,
17
17
  KEY string_data (STRING_DATA)
18
18
) ENGINE=MyISAM;
45
45
--enable_warnings
46
46
enable_query_log;
47
47
check table t1;
48
 
repair table t1;
49
48
 
50
49
# @TODO Because there are no notes on what the heck this
51
50
# is actually testing (which bug?), it's difficult to tell
55
54
#delete from t1 where (a & 1);
56
55
delete from t1 where (a mod 2) = 1;
57
56
check table t1;
58
 
repair table t1;
59
 
check table t1;
60
57
drop table t1;
61
58
 
62
59
#
75
72
# Test of how ORDER BY works when doing it on the whole table
76
73
#
77
74
 
78
 
create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=myisam;
 
75
create temporary table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=myisam;
79
76
insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
80
77
explain select * from t1 order by a;
81
78
explain select * from t1 order by b;
88
85
drop table t1;
89
86
 
90
87
#
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
 
#
101
88
# Test of optimize, when only mi_sort_index (but not mi_repair*) is done
102
89
# in ha_myisam::repair, and index size is changed (decreased).
103
90
#
140
127
# test of myisam with huge number of packed fields
141
128
#
142
129
 
143
 
create table t1 (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8
 
130
create temporary table t1 (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8
144
131
int, i9 int, i10 int, i11 int, i12 int, i13 int, i14 int, i15 int, i16 int, i17
145
132
int, i18 int, i19 int, i20 int, i21 int, i22 int, i23 int, i24 int, i25 int,
146
133
i26 int, i27 int, i28 int, i29 int, i30 int, i31 int, i32 int, i33 int, i34
315
302
#
316
303
# Test of REPAIR that once failed
317
304
#
318
 
CREATE TABLE `t1` (
 
305
CREATE TEMPORARY TABLE `t1` (
319
306
  `post_id` int NOT NULL auto_increment,
320
307
  `topic_id` int NOT NULL default '0',
321
308
  `post_time` datetime,
335
322
 
336
323
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');
337
324
 
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;
342
325
CHECK TABLE t1;
343
326
drop table t1;
344
327
 
347
330
#
348
331
 
349
332
--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;
 
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;
352
335
--error 1071
353
336
ALTER TABLE t1 ADD INDEX t1 (a, b, c, d, e);
354
337
DROP TABLE t1;
357
340
# Test of cardinality of keys with NULL
358
341
#
359
342
 
360
 
CREATE TABLE t1 (a int not null, b int, c int, key(b), key(c), key(a,b), key(c,a)) ENGINE=MyISAM;
 
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;
361
344
INSERT into t1 values (0, null, 0), (0, null, 1), (0, null, 2), (0, null,3), (1,1,4);
362
345
create table t2 (a int not null, b int, c int, key(b), key(c), key(a));
363
346
INSERT into t2 values (1,1,1), (2,2,2);
423
406
#
424
407
# two bugs in myisam-space-stripping feature
425
408
#
426
 
create table t1 ( a text not null, key a (a(20)));
 
409
create temporary table t1 ( a text not null, key a (a(20))) engine=myisam;
427
410
insert into t1 values ('aaa   '),('aaa'),('aa');
428
411
check table t1;
429
 
repair table t1;
430
412
select concat(a,'.') from t1 where a='aaa';
431
413
select concat(a,'.') from t1 where binary a='aaa';
432
414
update t1 set a='bbb' where a='aaa';
437
419
# Third bug in the same code (BUG#2295)
438
420
#
439
421
 
440
 
create table t1(a text not null, b text not null, c text not null, index (a(10),b(10),c(10)));
 
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;
441
423
insert into t1 values('807780', '477', '165');
442
424
insert into t1 values('807780', '477', '162');
443
425
insert into t1 values('807780', '472', '162');
448
430
# space-stripping in _mi_prefix_search: BUG#5284
449
431
#
450
432
DROP TABLE IF EXISTS t1;
451
 
CREATE TABLE t1 (a varchar(150) NOT NULL, KEY (a)) ENGINE=MyISAM; 
 
433
CREATE TEMPORARY TABLE t1 (a varchar(150) NOT NULL, KEY (a)) ENGINE=MyISAM; 
452
434
INSERT t1 VALUES ("can \tcan"); 
453
435
INSERT t1 VALUES ("can   can"); 
454
436
INSERT t1 VALUES ("can"); 
501
483
#
502
484
# Bug#14616 - Freshly imported table returns error 124 when using LIMIT
503
485
#
504
 
create table t1 (
 
486
create temporary table t1 (
505
487
  c1 varchar(32),
506
488
  key (c1)
507
489
) engine=myisam;
510
492
select c1 from t1 order by c1 limit 1;
511
493
drop table t1;
512
494
 
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
 
 
551
495
# End of 4.0 tests
552
496
 
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;
 
497
create table t1 (a int, b varchar(200), c text not null);
 
498
create table t2 (a int, b varchar(200), c text not null);
555
499
insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
556
500
insert t2 select * from t1;
557
501
checksum table t1, t2, t3 quick;
621
565
checksum table t2;
622
566
drop table t1, t2;
623
567
 
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
 
 
696
568
# BUG#13814 - key value packed incorrectly for TINYBLOBs
697
569
 
698
570
create table t1(
712
584
#
713
585
# Bug#14980 - COUNT(*) incorrect on MyISAM table with certain INDEX
714
586
#
715
 
create table t1 (
 
587
create temporary table t1 (
716
588
  id1 int not null auto_increment,
717
589
  id2 int not null default '0',
718
590
  t text not null,
731
603
# BUG##20357 - Got error 124 from storage engine using MIN and MAX functions
732
604
#              in queries
733
605
#
734
 
CREATE TABLE t1(a int, KEY(a)) ENGINE=MyISAM;
 
606
CREATE TEMPORARY TABLE t1(a int, KEY(a)) ENGINE=MyISAM;
735
607
INSERT INTO t1 VALUES(1);
736
608
SELECT MAX(a) FROM t1 IGNORE INDEX(a);
737
609
ALTER TABLE t1 DISABLE KEYS;
740
612
DROP TABLE t1;
741
613
 
742
614
#
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
 
#
752
615
# Bug#8283 - OPTIMIZE TABLE causes data loss
753
616
#
754
617
SET GLOBAL myisam_repair_threads=2;
755
618
SHOW VARIABLES LIKE 'myisam_repair%';
756
619
#
757
620
# Test OPTIMIZE. This creates a new data file.
758
 
CREATE TABLE t1 (
 
621
CREATE TEMPORARY TABLE t1 (
759
622
  `_id` int NOT NULL default '0',
760
623
  `url` text,
761
624
  `email` text,
796
659
SELECT _id FROM t1;
797
660
DROP TABLE t1;
798
661
#
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
662
SET GLOBAL myisam_repair_threads=1;
842
663
SHOW VARIABLES LIKE 'myisam_repair%';
843
664
 
844
665
#
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;
861
 
DROP TABLE t1;
862
 
 
863
 
#
864
666
# Bug#24607 - MyISAM pointer size determined incorrectly
865
667
#
866
 
CREATE TABLE t1 (c1 TEXT) ENGINE=MyISAM AVG_ROW_LENGTH=70100 MAX_ROWS=4100100100;
 
668
CREATE TEMPORARY TABLE t1 (c1 TEXT) ENGINE=MyISAM;
867
669
--replace_column 5 X 6 X 7 X 9 X 10 X 11 X 12 X 13 X 14 X 16 X
868
670
SHOW TABLE STATUS LIKE 't1';
869
671
DROP TABLE t1;
872
674
# Bug#26231 - select count(*) on myisam table returns wrong value
873
675
#             when index is used
874
676
#
875
 
CREATE TABLE t1 (c1 TEXT NOT NULL, KEY c1 (c1(10))) ENGINE=MyISAM;
 
677
CREATE TEMPORARY TABLE t1 (c1 TEXT NOT NULL, KEY c1 (c1(10))) ENGINE=MyISAM;
876
678
# Fill at least two key blocks. "Tab, A" must be in both blocks. 
877
679
INSERT INTO t1 VALUES
878
680
  (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
1020
822
 
1021
823
let $default=`select @@storage_engine`;
1022
824
set storage_engine=MyISAM;
 
825
let $temp= TEMPORARY;
1023
826
source include/varchar.inc;
1024
827
 
1025
828
#
1027
830
#
1028
831
 
1029
832
--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));
 
833
create temporary table t1 (v varchar(65530), key(v));
 
834
--error 1074
 
835
create temporary table t1 (v varchar(65536));
 
836
--error 1074
 
837
create temporary table t1 (v varchar(65530));
1035
838
 
1036
839
# MyISAM specific varchar tests
1037
840
--error 1074
1038
 
create table t1 (v varchar(65535));
 
841
create temporary table t1 (v varchar(65535));
1039
842
 
1040
843
eval set storage_engine=$default;
1041
844
 
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
 
 
1101
845
 
1102
846
# BUG#9622 - ANALYZE TABLE and ALTER TABLE .. ENABLE INDEX produce
1103
847
# different statistics on the same table with NULL values.
1115
859
 
1116
860
 
1117
861
#
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
 
#
1129
862
# Bug#28476: force index on a disabled myisam index gives error 124
1130
863
#
1131
 
CREATE TABLE t1(a INT, b INT, KEY inx (a), UNIQUE KEY uinx (b)) ENGINE=MyISAM;
 
864
CREATE TEMPORARY TABLE t1(a INT, b INT, KEY inx (a), UNIQUE KEY uinx (b)) ENGINE=MyISAM;
1132
865
INSERT INTO t1(a,b) VALUES (1,1),(2,2),(3,3),(4,4),(5,5);
1133
866
SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1;
1134
867
ALTER TABLE t1 DISABLE KEYS;
1144
877
#
1145
878
# Bug#4692 - DISABLE/ENABLE KEYS waste a space
1146
879
#
1147
 
CREATE TABLE t1 (c1 INT, c2 INT, UNIQUE INDEX (c1), INDEX (c2)) ENGINE=MYISAM;
 
880
CREATE TEMPORARY TABLE t1 (c1 INT, c2 INT, UNIQUE INDEX (c1), INDEX (c2)) ENGINE=MYISAM;
1148
881
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
1149
882
SHOW TABLE STATUS LIKE 't1';
1150
883
INSERT INTO t1 VALUES (1,1);
1176
909
#
1177
910
# Bug#28837: MyISAM storage engine error (134) doing delete with self-join
1178
911
#
1179
 
 
1180
 
CREATE TABLE t1 (id int NOT NULL, ref int NOT NULL, INDEX (id)) ENGINE=MyISAM;
 
912
# DRIZZLE NOTE: Cannot self join on temp tables.
 
913
CREATE TABLE t1 (id int NOT NULL, ref int NOT NULL, INDEX (id));
1181
914
CREATE TABLE t2 LIKE t1;
1182
915
 
1183
916
INSERT INTO t2 (id, ref) VALUES (1,3), (2,1), (3,2), (4,5), (4,4);
1185
918
 
1186
919
SELECT * FROM t1 AS a INNER JOIN t1 AS b USING (id) WHERE a.ref < b.ref;
1187
920
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;
1190
921
 
1191
922
DROP TABLE t1, t2;
1192
923
 
1197
928
# Test of key_block_size
1198
929
#
1199
930
 
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;
 
931
create temporary table t1 (a int not null, key `a` (a) key_block_size=1024) ENGINE=MyISAM;
 
932
show create table t1;
 
933
drop table t1;
 
934
 
 
935
create temporary table t1 (a int not null, key `a` (a) key_block_size=2048) ENGINE=MyISAM;
 
936
show create table t1;
 
937
drop table t1;
 
938
 
 
939
create temporary table t1 (a varchar(2048), key `a` (a)) ENGINE=MyISAM;
 
940
show create table t1;
 
941
drop table t1;
 
942
 
 
943
create temporary table t1 (a varchar(2048), key `a` (a) key_block_size=1024) ENGINE=MyISAM;
 
944
show create table t1;
 
945
drop table t1;
 
946
 
 
947
create temporary table t1 (a int not null, b varchar(2048), key (a), key(b)) ENGINE=MyISAM key_block_size=1024;
1217
948
show create table t1;
1218
949
alter table t1 key_block_size=2048;
1219
950
show create table t1;
1224
955
show create table t1;
1225
956
drop table t1;
1226
957
 
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;
 
958
create temporary table t1 (a int not null, b varchar(2048), key (a), key(b)) ENGINE=MyISAM key_block_size=8192;
 
959
show create table t1;
 
960
drop table t1;
 
961
 
 
962
create temporary table t1 (a int not null, b varchar(2048), key (a) key_block_size=1024, key(b)) ENGINE=MyISAM key_block_size=8192;
 
963
show create table t1;
 
964
drop table t1;
 
965
 
 
966
create temporary 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
967
show create table t1;
1237
968
drop table t1;
1238
969
 
1239
970
 
1240
971
# Test limits and errors of key_block_size
1241
972
 
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;
 
973
create temporary table t1 (a int not null, key `a` (a) key_block_size=512) ENGINE=MyISAM;
 
974
show create table t1;
 
975
drop table t1;
 
976
 
 
977
create temporary table t1 (a varchar(2048), key `a` (a) key_block_size=1000000000000000000) ENGINE=MyISAM;
 
978
show create table t1;
 
979
drop table t1;
 
980
 
 
981
create temporary table t1 (a int not null, key `a` (a) key_block_size=1025) ENGINE=MyISAM;
 
982
show create table t1;
 
983
drop table t1;
 
984
 
 
985
--error 1064
 
986
create temporary table t1 (a int not null, key key_block_size=1024 (a)) ENGINE=MyISAM;
 
987
--error 1064
 
988
create temporary table t1 (a int not null, key `a` key_block_size=1024 (a)) ENGINE=MyISAM;
1258
989
 
1259
990
#
1260
991
# Bug#22119 - Changing MI_KEY_BLOCK_LENGTH makes a wrong myisamchk
1261
992
#
1262
 
CREATE TABLE t1 (
 
993
CREATE temporary TABLE t1 (
1263
994
  c1 INT,
1264
995
  c2 VARCHAR(300),
1265
996
  KEY (c1) KEY_BLOCK_SIZE 1024,
1291
1022
  (33, REPEAT('x', CEIL(RAND() * 300))),
1292
1023
  (34, REPEAT('y', CEIL(RAND() * 300))),
1293
1024
  (35, REPEAT('z', CEIL(RAND() * 300)));
1294
 
INSERT INTO t1 SELECT * FROM t1;
1295
 
INSERT INTO t1 SELECT * FROM t1;
 
1025
CREATE TEMPORARY TABLE t2 AS SELECT * FROM t1;
 
1026
INSERT INTO t1 SELECT * FROM t2;
 
1027
DROP TABLE t2;
 
1028
CREATE TEMPORARY TABLE t2 AS SELECT * FROM t1;
 
1029
INSERT INTO t1 SELECT * FROM t2;
 
1030
DROP TABLE t2;
1296
1031
CHECK TABLE t1;
1297
 
REPAIR TABLE t1;
1298
1032
DELETE FROM t1 WHERE c1 >= 10;
1299
1033
CHECK TABLE t1;
1300
1034
DROP TABLE t1;
1306
1040
# Test #1 - CHECK TABLE sees wrong record, REPAR TABLE deletes it.
1307
1041
# Using a CHAR column that can have > 127 characters.
1308
1042
# Using a VARCHAR to create a table with dynamic row format.
1309
 
CREATE TABLE t1 (
 
1043
CREATE temporary TABLE t1 (
1310
1044
  c1 CHAR(130),
1311
1045
  c2 VARCHAR(1)
1312
1046
) ENGINE=MyISAM;
1313
1047
INSERT INTO t1 VALUES(REPEAT("a",128), 'b');
1314
1048
SELECT COUNT(*) FROM t1;
1315
1049
CHECK TABLE t1;
1316
 
REPAIR TABLE t1;
1317
1050
SELECT COUNT(*) FROM t1;
1318
1051
CHECK TABLE t1;
1319
1052
DROP TABLE t1;
1321
1054
# Test #2 - same as test #1, but using EXTENDED.
1322
1055
# Using a CHAR column that can have > 127 characters.
1323
1056
# Using a VARCHAR to create a table with dynamic row format.
1324
 
CREATE TABLE t1 (
 
1057
CREATE temporary TABLE t1 (
1325
1058
  c1 CHAR(130),
1326
1059
  c2 VARCHAR(1)
1327
1060
) ENGINE=MyISAM;
1328
1061
INSERT INTO t1 VALUES(REPEAT("a",128), 'b');
1329
1062
SELECT COUNT(*) FROM t1;
1330
1063
CHECK TABLE t1 EXTENDED;
1331
 
REPAIR TABLE t1 EXTENDED;
1332
1064
SELECT COUNT(*) FROM t1;
1333
1065
CHECK TABLE t1 EXTENDED;
1334
1066
DROP TABLE t1;
1336
1068
# Test #3 - same as test #1, but using OPTIMIZE TABLE.
1337
1069
# Using a CHAR column that can have > 127 characters.
1338
1070
# Using a VARCHAR to create a table with dynamic row format.
1339
 
CREATE TABLE t1 (
 
1071
CREATE temporary TABLE t1 (
1340
1072
  c1 CHAR(130),
1341
1073
  c2 VARCHAR(1)
1342
1074
) ENGINE=MyISAM;
1354
1086
# Using a CHAR column that can have > 127 characters.
1355
1087
# Using a VARCHAR to create a table with dynamic row format.
1356
1088
# Using an index which can be disabled during bulk insert.
1357
 
CREATE TABLE t1 (
 
1089
CREATE temporary TABLE t1 (
1358
1090
  c1 CHAR(130),
1359
1091
  c2 VARCHAR(1),
1360
1092
  KEY (c1)
1387
1119
# Test #5 - same as test #1 but UTF-8.
1388
1120
# Using a CHAR column that can have > 127 characters.
1389
1121
# Using a VARCHAR to create a table with dynamic row format.
1390
 
CREATE TABLE t1 (
 
1122
CREATE temporary TABLE t1 (
1391
1123
  c1 CHAR(50),
1392
1124
  c2 VARCHAR(1)
1393
1125
) ENGINE=MyISAM;
1395
1127
INSERT INTO t1 VALUES(REPEAT( x'e0ae85',43), 'b');
1396
1128
SELECT COUNT(*) FROM t1;
1397
1129
CHECK TABLE t1;
1398
 
REPAIR TABLE t1;
1399
1130
SELECT COUNT(*) FROM t1;
1400
1131
CHECK TABLE t1;
1401
1132
DROP TABLE t1;
1403
1134
# Test #6 - same as test #2, but UTF-8.
1404
1135
# Using a CHAR column that can have > 127 characters.
1405
1136
# Using a VARCHAR to create a table with dynamic row format.
1406
 
CREATE TABLE t1 (
 
1137
CREATE temporary TABLE t1 (
1407
1138
  c1 CHAR(50),
1408
1139
  c2 VARCHAR(1)
1409
1140
) ENGINE=MyISAM;
1411
1142
INSERT INTO t1 VALUES(REPEAT( x'e0ae85',43), 'b');
1412
1143
SELECT COUNT(*) FROM t1;
1413
1144
CHECK TABLE t1 EXTENDED;
1414
 
REPAIR TABLE t1 EXTENDED;
1415
1145
SELECT COUNT(*) FROM t1;
1416
1146
CHECK TABLE t1 EXTENDED;
1417
1147
DROP TABLE t1;
1419
1149
# Test #7 - same as test #3, but UTF-8.
1420
1150
# Using a CHAR column that can have > 127 characters.
1421
1151
# Using a VARCHAR to create a table with dynamic row format.
1422
 
CREATE TABLE t1 (
 
1152
CREATE temporary TABLE t1 (
1423
1153
  c1 CHAR(50),
1424
1154
  c2 VARCHAR(1)
1425
1155
) ENGINE=MyISAM;
1438
1168
# Using a CHAR column that can have > 42 UTF-8 characters.
1439
1169
# Using a VARCHAR to create a table with dynamic row format.
1440
1170
# Using an index which can be disabled during bulk insert.
1441
 
CREATE TABLE t1 (
 
1171
CREATE temporary TABLE t1 (
1442
1172
  c1 CHAR(50),
1443
1173
  c2 VARCHAR(1),
1444
1174
  KEY (c1)
1468
1198
CHECK TABLE t1;
1469
1199
CHECK TABLE t1 EXTENDED;
1470
1200
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
 
#
1487
1201
--echo End of 5.1 tests
1488
1202