1# 2# Test bugs in the MyISAM code 3# 4 5--source include/default_optimizer_switch.inc 6 7call mtr.add_suppression("Can't find record in '.*'"); 8call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired"); 9 10# Initialise 11--disable_warnings 12drop table if exists t1,t2,t3; 13--enable_warnings 14SET SQL_WARNINGS=1; 15 16# 17# Test problem with CHECK TABLE; 18# 19 20CREATE TABLE t1 ( 21 STRING_DATA char(255) default NULL, 22 KEY string_data (STRING_DATA) 23) ENGINE=MyISAM; 24 25INSERT INTO t1 VALUES ('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); 26INSERT INTO t1 VALUES ('DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD'); 27INSERT INTO t1 VALUES ('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'); 28INSERT INTO t1 VALUES ('FGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG'); 29INSERT INTO t1 VALUES ('HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH'); 30INSERT INTO t1 VALUES ('WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW'); 31CHECK TABLE t1; 32drop table t1; 33 34# 35# Test problem with rows that are 65517-65520 bytes long 36# 37 38create table t1 (a tinyint not null auto_increment, b blob not null, primary key (a)); 39 40let $1=100; 41--disable_query_log 42begin; 43--disable_warnings 44SET SQL_WARNINGS=0; 45while ($1) 46{ 47 eval insert ignore into t1 (b) values(repeat(char(65+$1),65550-$1)); 48 dec $1; 49} 50commit; 51SET SQL_WARNINGS=1; 52--enable_warnings 53--enable_query_log 54check table t1; 55repair table t1; 56delete from t1 where (a & 1); 57check table t1; 58repair table t1; 59check table t1; 60drop table t1; 61 62# 63# Test bug: Two optimize in a row reset index cardinality 64# 65 66create table t1 (a int not null auto_increment, b int not null, primary key (a), index(b)); 67insert into t1 (b) values (1),(2),(2),(2),(2); 68optimize table t1; 69show index from t1; 70optimize table t1; 71show index from t1; 72drop table t1; 73 74# 75# Test of how ORDER BY works when doing it on the whole table 76# 77 78create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=myisam; 79insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4); 80explain select * from t1 order by a; 81explain select * from t1 order by b; 82explain select * from t1 order by c; 83explain select a from t1 order by a; 84explain select b from t1 order by b; 85explain select a,b from t1 order by b; 86explain select a,b from t1; 87explain select a,b,c from t1; 88drop table t1; 89 90# 91# Test of OPTIMIZE of locked and modified tables 92# 93CREATE TABLE t1 (a INT); 94INSERT INTO t1 VALUES (1), (2), (3); 95LOCK TABLES t1 WRITE; 96INSERT INTO t1 VALUES (1), (2), (3); 97OPTIMIZE TABLE t1; 98DROP TABLE t1; 99 100# 101# Test of optimize, when only mi_sort_index (but not mi_repair*) is done 102# in ha_myisam::repair, and index size is changed (decreased). 103# 104 105create table t1 ( t1 char(255), key(t1(250))); 106insert t1 values ('137513751375137513751375137513751375137569516951695169516951695169516951695169'); 107insert t1 values ('178417841784178417841784178417841784178403420342034203420342034203420342034203'); 108insert t1 values ('213872387238723872387238723872387238723867376737673767376737673767376737673767'); 109insert t1 values ('242624262426242624262426242624262426242607890789078907890789078907890789078907'); 110insert t1 values ('256025602560256025602560256025602560256011701170117011701170117011701170117011'); 111insert t1 values ('276027602760276027602760276027602760276001610161016101610161016101610161016101'); 112insert t1 values ('281528152815281528152815281528152815281564956495649564956495649564956495649564'); 113insert t1 values ('292129212921292129212921292129212921292102100210021002100210021002100210021002'); 114insert t1 values ('380638063806380638063806380638063806380634483448344834483448344834483448344834'); 115insert t1 values ('411641164116411641164116411641164116411616301630163016301630163016301630163016'); 116insert t1 values ('420842084208420842084208420842084208420899889988998899889988998899889988998899'); 117insert t1 values ('438443844384438443844384438443844384438482448244824482448244824482448244824482'); 118insert t1 values ('443244324432443244324432443244324432443239613961396139613961396139613961396139'); 119insert t1 values ('485448544854485448544854485448544854485477847784778477847784778477847784778477'); 120insert t1 values ('494549454945494549454945494549454945494555275527552755275527552755275527552755'); 121insert t1 values ('538647864786478647864786478647864786478688918891889188918891889188918891889188'); 122insert t1 values ('565556555655565556555655565556555655565554845484548454845484548454845484548454'); 123insert t1 values ('607860786078607860786078607860786078607856665666566656665666566656665666566656'); 124insert t1 values ('640164016401640164016401640164016401640141274127412741274127412741274127412741'); 125insert t1 values ('719471947194719471947194719471947194719478717871787178717871787178717871787178'); 126insert t1 values ('742574257425742574257425742574257425742549604960496049604960496049604960496049'); 127insert t1 values ('887088708870887088708870887088708870887035963596359635963596359635963596359635'); 128insert t1 values ('917791779177917791779177917791779177917773857385738573857385738573857385738573'); 129insert t1 values ('933293329332933293329332933293329332933278987898789878987898789878987898789878'); 130insert t1 values ('963896389638963896389638963896389638963877807780778077807780778077807780778077'); 131delete from t1 where t1>'2'; 132insert t1 values ('70'), ('84'), ('60'), ('20'), ('76'), ('89'), ('49'), ('50'), 133('88'), ('61'), ('42'), ('98'), ('39'), ('30'), ('25'), ('66'), ('61'), ('48'), 134('80'), ('84'), ('98'), ('19'), ('91'), ('42'), ('47'); 135optimize table t1; 136check table t1; 137drop table t1; 138 139# 140# test of myisam with huge number of packed fields 141# 142 143create table t1 (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8 144int, i9 int, i10 int, i11 int, i12 int, i13 int, i14 int, i15 int, i16 int, i17 145int, i18 int, i19 int, i20 int, i21 int, i22 int, i23 int, i24 int, i25 int, 146i26 int, i27 int, i28 int, i29 int, i30 int, i31 int, i32 int, i33 int, i34 147int, i35 int, i36 int, i37 int, i38 int, i39 int, i40 int, i41 int, i42 int, 148i43 int, i44 int, i45 int, i46 int, i47 int, i48 int, i49 int, i50 int, i51 149int, i52 int, i53 int, i54 int, i55 int, i56 int, i57 int, i58 int, i59 int, 150i60 int, i61 int, i62 int, i63 int, i64 int, i65 int, i66 int, i67 int, i68 151int, i69 int, i70 int, i71 int, i72 int, i73 int, i74 int, i75 int, i76 int, 152i77 int, i78 int, i79 int, i80 int, i81 int, i82 int, i83 int, i84 int, i85 153int, i86 int, i87 int, i88 int, i89 int, i90 int, i91 int, i92 int, i93 int, 154i94 int, i95 int, i96 int, i97 int, i98 int, i99 int, i100 int, i101 int, i102 155int, i103 int, i104 int, i105 int, i106 int, i107 int, i108 int, i109 int, i110 156int, i111 int, i112 int, i113 int, i114 int, i115 int, i116 int, i117 int, i118 157int, i119 int, i120 int, i121 int, i122 int, i123 int, i124 int, i125 int, i126 158int, i127 int, i128 int, i129 int, i130 int, i131 int, i132 int, i133 int, i134 159int, i135 int, i136 int, i137 int, i138 int, i139 int, i140 int, i141 int, i142 160int, i143 int, i144 int, i145 int, i146 int, i147 int, i148 int, i149 int, i150 161int, i151 int, i152 int, i153 int, i154 int, i155 int, i156 int, i157 int, i158 162int, i159 int, i160 int, i161 int, i162 int, i163 int, i164 int, i165 int, i166 163int, i167 int, i168 int, i169 int, i170 int, i171 int, i172 int, i173 int, i174 164int, i175 int, i176 int, i177 int, i178 int, i179 int, i180 int, i181 int, i182 165int, i183 int, i184 int, i185 int, i186 int, i187 int, i188 int, i189 int, i190 166int, i191 int, i192 int, i193 int, i194 int, i195 int, i196 int, i197 int, i198 167int, i199 int, i200 int, i201 int, i202 int, i203 int, i204 int, i205 int, i206 168int, i207 int, i208 int, i209 int, i210 int, i211 int, i212 int, i213 int, i214 169int, i215 int, i216 int, i217 int, i218 int, i219 int, i220 int, i221 int, i222 170int, i223 int, i224 int, i225 int, i226 int, i227 int, i228 int, i229 int, i230 171int, i231 int, i232 int, i233 int, i234 int, i235 int, i236 int, i237 int, i238 172int, i239 int, i240 int, i241 int, i242 int, i243 int, i244 int, i245 int, i246 173int, i247 int, i248 int, i249 int, i250 int, i251 int, i252 int, i253 int, i254 174int, i255 int, i256 int, i257 int, i258 int, i259 int, i260 int, i261 int, i262 175int, i263 int, i264 int, i265 int, i266 int, i267 int, i268 int, i269 int, i270 176int, i271 int, i272 int, i273 int, i274 int, i275 int, i276 int, i277 int, i278 177int, i279 int, i280 int, i281 int, i282 int, i283 int, i284 int, i285 int, i286 178int, i287 int, i288 int, i289 int, i290 int, i291 int, i292 int, i293 int, i294 179int, i295 int, i296 int, i297 int, i298 int, i299 int, i300 int, i301 int, i302 180int, i303 int, i304 int, i305 int, i306 int, i307 int, i308 int, i309 int, i310 181int, i311 int, i312 int, i313 int, i314 int, i315 int, i316 int, i317 int, i318 182int, i319 int, i320 int, i321 int, i322 int, i323 int, i324 int, i325 int, i326 183int, i327 int, i328 int, i329 int, i330 int, i331 int, i332 int, i333 int, i334 184int, i335 int, i336 int, i337 int, i338 int, i339 int, i340 int, i341 int, i342 185int, i343 int, i344 int, i345 int, i346 int, i347 int, i348 int, i349 int, i350 186int, i351 int, i352 int, i353 int, i354 int, i355 int, i356 int, i357 int, i358 187int, i359 int, i360 int, i361 int, i362 int, i363 int, i364 int, i365 int, i366 188int, i367 int, i368 int, i369 int, i370 int, i371 int, i372 int, i373 int, i374 189int, i375 int, i376 int, i377 int, i378 int, i379 int, i380 int, i381 int, i382 190int, i383 int, i384 int, i385 int, i386 int, i387 int, i388 int, i389 int, i390 191int, i391 int, i392 int, i393 int, i394 int, i395 int, i396 int, i397 int, i398 192int, i399 int, i400 int, i401 int, i402 int, i403 int, i404 int, i405 int, i406 193int, i407 int, i408 int, i409 int, i410 int, i411 int, i412 int, i413 int, i414 194int, i415 int, i416 int, i417 int, i418 int, i419 int, i420 int, i421 int, i422 195int, i423 int, i424 int, i425 int, i426 int, i427 int, i428 int, i429 int, i430 196int, i431 int, i432 int, i433 int, i434 int, i435 int, i436 int, i437 int, i438 197int, i439 int, i440 int, i441 int, i442 int, i443 int, i444 int, i445 int, i446 198int, i447 int, i448 int, i449 int, i450 int, i451 int, i452 int, i453 int, i454 199int, i455 int, i456 int, i457 int, i458 int, i459 int, i460 int, i461 int, i462 200int, i463 int, i464 int, i465 int, i466 int, i467 int, i468 int, i469 int, i470 201int, i471 int, i472 int, i473 int, i474 int, i475 int, i476 int, i477 int, i478 202int, i479 int, i480 int, i481 int, i482 int, i483 int, i484 int, i485 int, i486 203int, i487 int, i488 int, i489 int, i490 int, i491 int, i492 int, i493 int, i494 204int, i495 int, i496 int, i497 int, i498 int, i499 int, i500 int, i501 int, i502 205int, i503 int, i504 int, i505 int, i506 int, i507 int, i508 int, i509 int, i510 206int, i511 int, i512 int, i513 int, i514 int, i515 int, i516 int, i517 int, i518 207int, i519 int, i520 int, i521 int, i522 int, i523 int, i524 int, i525 int, i526 208int, i527 int, i528 int, i529 int, i530 int, i531 int, i532 int, i533 int, i534 209int, i535 int, i536 int, i537 int, i538 int, i539 int, i540 int, i541 int, i542 210int, i543 int, i544 int, i545 int, i546 int, i547 int, i548 int, i549 int, i550 211int, i551 int, i552 int, i553 int, i554 int, i555 int, i556 int, i557 int, i558 212int, i559 int, i560 int, i561 int, i562 int, i563 int, i564 int, i565 int, i566 213int, i567 int, i568 int, i569 int, i570 int, i571 int, i572 int, i573 int, i574 214int, i575 int, i576 int, i577 int, i578 int, i579 int, i580 int, i581 int, i582 215int, i583 int, i584 int, i585 int, i586 int, i587 int, i588 int, i589 int, i590 216int, i591 int, i592 int, i593 int, i594 int, i595 int, i596 int, i597 int, i598 217int, i599 int, i600 int, i601 int, i602 int, i603 int, i604 int, i605 int, i606 218int, i607 int, i608 int, i609 int, i610 int, i611 int, i612 int, i613 int, i614 219int, i615 int, i616 int, i617 int, i618 int, i619 int, i620 int, i621 int, i622 220int, i623 int, i624 int, i625 int, i626 int, i627 int, i628 int, i629 int, i630 221int, i631 int, i632 int, i633 int, i634 int, i635 int, i636 int, i637 int, i638 222int, i639 int, i640 int, i641 int, i642 int, i643 int, i644 int, i645 int, i646 223int, i647 int, i648 int, i649 int, i650 int, i651 int, i652 int, i653 int, i654 224int, i655 int, i656 int, i657 int, i658 int, i659 int, i660 int, i661 int, i662 225int, i663 int, i664 int, i665 int, i666 int, i667 int, i668 int, i669 int, i670 226int, i671 int, i672 int, i673 int, i674 int, i675 int, i676 int, i677 int, i678 227int, i679 int, i680 int, i681 int, i682 int, i683 int, i684 int, i685 int, i686 228int, i687 int, i688 int, i689 int, i690 int, i691 int, i692 int, i693 int, i694 229int, i695 int, i696 int, i697 int, i698 int, i699 int, i700 int, i701 int, i702 230int, i703 int, i704 int, i705 int, i706 int, i707 int, i708 int, i709 int, i710 231int, i711 int, i712 int, i713 int, i714 int, i715 int, i716 int, i717 int, i718 232int, i719 int, i720 int, i721 int, i722 int, i723 int, i724 int, i725 int, i726 233int, i727 int, i728 int, i729 int, i730 int, i731 int, i732 int, i733 int, i734 234int, i735 int, i736 int, i737 int, i738 int, i739 int, i740 int, i741 int, i742 235int, i743 int, i744 int, i745 int, i746 int, i747 int, i748 int, i749 int, i750 236int, i751 int, i752 int, i753 int, i754 int, i755 int, i756 int, i757 int, i758 237int, i759 int, i760 int, i761 int, i762 int, i763 int, i764 int, i765 int, i766 238int, i767 int, i768 int, i769 int, i770 int, i771 int, i772 int, i773 int, i774 239int, i775 int, i776 int, i777 int, i778 int, i779 int, i780 int, i781 int, i782 240int, i783 int, i784 int, i785 int, i786 int, i787 int, i788 int, i789 int, i790 241int, i791 int, i792 int, i793 int, i794 int, i795 int, i796 int, i797 int, i798 242int, i799 int, i800 int, i801 int, i802 int, i803 int, i804 int, i805 int, i806 243int, i807 int, i808 int, i809 int, i810 int, i811 int, i812 int, i813 int, i814 244int, i815 int, i816 int, i817 int, i818 int, i819 int, i820 int, i821 int, i822 245int, i823 int, i824 int, i825 int, i826 int, i827 int, i828 int, i829 int, i830 246int, i831 int, i832 int, i833 int, i834 int, i835 int, i836 int, i837 int, i838 247int, i839 int, i840 int, i841 int, i842 int, i843 int, i844 int, i845 int, i846 248int, i847 int, i848 int, i849 int, i850 int, i851 int, i852 int, i853 int, i854 249int, i855 int, i856 int, i857 int, i858 int, i859 int, i860 int, i861 int, i862 250int, i863 int, i864 int, i865 int, i866 int, i867 int, i868 int, i869 int, i870 251int, i871 int, i872 int, i873 int, i874 int, i875 int, i876 int, i877 int, i878 252int, i879 int, i880 int, i881 int, i882 int, i883 int, i884 int, i885 int, i886 253int, i887 int, i888 int, i889 int, i890 int, i891 int, i892 int, i893 int, i894 254int, i895 int, i896 int, i897 int, i898 int, i899 int, i900 int, i901 int, i902 255int, i903 int, i904 int, i905 int, i906 int, i907 int, i908 int, i909 int, i910 256int, i911 int, i912 int, i913 int, i914 int, i915 int, i916 int, i917 int, i918 257int, i919 int, i920 int, i921 int, i922 int, i923 int, i924 int, i925 int, i926 258int, i927 int, i928 int, i929 int, i930 int, i931 int, i932 int, i933 int, i934 259int, i935 int, i936 int, i937 int, i938 int, i939 int, i940 int, i941 int, i942 260int, i943 int, i944 int, i945 int, i946 int, i947 int, i948 int, i949 int, i950 261int, i951 int, i952 int, i953 int, i954 int, i955 int, i956 int, i957 int, i958 262int, i959 int, i960 int, i961 int, i962 int, i963 int, i964 int, i965 int, i966 263int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974 264int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982 265int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990 266int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998 267int, i999 int, i1000 int, b blob) row_format=dynamic; 268insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2691, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2701, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2711, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2721, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2731, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2741, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2751, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2761, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2771, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2781, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2791, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2801, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2811, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2821, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2831, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2841, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2851, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2861, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2871, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2881, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2891, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2901, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2911, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2921, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2931, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2941, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2951, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2961, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2971, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2981, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2991, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3001, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3011, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3021, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3031, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3041, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3051, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3061, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, "Sergei"); 307update t1 set b=repeat('a',256); 308update t1 set i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0; 309check table t1; 310delete from t1 where i8=1; 311select i1,i2 from t1; 312check table t1; 313drop table t1; 314 315# 316# Test of REPAIR that once failed 317# 318SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR 319CREATE TABLE `t1` ( 320 `post_id` mediumint(8) unsigned NOT NULL auto_increment, 321 `topic_id` mediumint(8) unsigned NOT NULL default '0', 322 `post_time` datetime NOT NULL default '0000-00-00 00:00:00', 323 `post_text` text NOT NULL, 324 `icon_url` varchar(10) NOT NULL default '', 325 `sign` tinyint(1) unsigned NOT NULL default '0', 326 `post_edit` varchar(150) NOT NULL default '', 327 `poster_login` varchar(35) NOT NULL default '', 328 `ip` varchar(15) NOT NULL default '', 329 PRIMARY KEY (`post_id`), 330 KEY `post_time` (`post_time`), 331 KEY `ip` (`ip`), 332 KEY `poster_login` (`poster_login`), 333 KEY `topic_id` (`topic_id`), 334 FULLTEXT KEY `post_text` (`post_text`) 335) ENGINE=MyISAM; 336 337INSERT IGNORE 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'); 338 339REPAIR TABLE t1; 340CHECK TABLE t1; 341drop table t1; 342 343# 344# Test of creating table with too long key 345# 346 347--error 1071 348CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255), d varchar(255), e varchar(255), KEY t1 (a, b, c, d, e)); 349CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255), d varchar(255), e varchar(255)); 350--error 1071 351ALTER TABLE t1 ADD INDEX t1 (a, b, c, d, e); 352DROP TABLE t1; 353 354# 355# Test of cardinality of keys with NULL 356# 357 358CREATE TABLE t1 (a int not null, b int, c int, key(b), key(c), key(a,b), key(c,a)); 359INSERT into t1 values (0,null,0), (0,null,1), (0,null,2), (0,null,3), (1,1,4); 360create table t2 (a int not null, b int, c int, key(b), key(c), key(a)); 361INSERT into t2 values (1,1,1), (2,2,2); 362optimize table t1; 363show index from t1; 364explain select * from t1,t2 where t1.a=t2.a; 365explain select * from t1,t2 force index(a) where t1.a=t2.a; 366explain select * from t1 force index(a),t2 force index(a) where t1.a=t2.a; 367INSERT into t1 values (2,4,5), (7,8,4), (8,3,1), (9,7,2), (5,5,9); 368optimize table t1; 369show index from t1; 370explain select * from t1,t2 where t1.b=t2.b; 371delete from t1 where t1.a>1; 372optimize table t1; 373show index from t1; 374explain select * from t1,t2 force index(c) where t1.a=t2.a; 375explain select * from t1 where a=0 or a=2; 376explain select * from t1 force index (a) where a=0 or a=2; 377explain select * from t1 where c=1; 378explain select * from t1 use index() where c=1; 379drop table t1,t2; 380 381# 382# Test bug when updating a split dynamic row where keys are not changed 383# 384 385create table t1 (a int not null auto_increment primary key, b varchar(255)); 386insert into t1 (b) values (repeat('a',100)),(repeat('b',100)),(repeat('c',100)); 387update t1 set b=repeat(left(b,1),200) where a=1; 388delete from t1 where (a & 1)= 0; 389update t1 set b=repeat('e',200) where a=1; 390flush tables; 391check table t1; 392 393# 394# check updating with keys 395# 396 397--disable_query_log 398begin; 399let $1 = 100; 400while ($1) 401{ 402 eval insert into t1 (b) values (repeat(char(($1 & 32)+65), $1)); 403 dec $1; 404} 405commit; 406--enable_query_log 407update t1 set b=repeat(left(b,1),255) where a between 1 and 5; 408update t1 set b=repeat(left(b,1),10) where a between 32 and 43; 409update t1 set b=repeat(left(b,1),2) where a between 64 and 66; 410update t1 set b=repeat(left(b,1),65) where a between 67 and 70; 411check table t1; 412insert into t1 (b) values (repeat('z',100)); 413update t1 set b="test" where left(b,1) > 'n'; 414check table t1; 415drop table t1; 416 417# 418# two bugs in myisam-space-stripping feature 419# 420create table t1 ( a text not null, key a (a(20))); 421insert into t1 values ('aaa '),('aaa'),('aa'); 422check table t1; 423repair table t1; 424select concat(a,'.') from t1 where a='aaa'; 425select concat(a,'.') from t1 where binary a='aaa'; 426update t1 set a='bbb' where a='aaa'; 427select concat(a,'.') from t1; 428drop table t1; 429 430# 431# Third bug in the same code (BUG#2295) 432# 433 434create table t1(a text not null, b text not null, c text not null, index (a(10),b(10),c(10))); 435insert into t1 values('807780', '477', '165'); 436insert into t1 values('807780', '477', '162'); 437insert into t1 values('807780', '472', '162'); 438select * from t1 where a='807780' and b='477' and c='165'; 439drop table t1; 440 441# 442# space-stripping in _mi_prefix_search: BUG#5284 443# 444DROP TABLE IF EXISTS t1; 445CREATE TABLE t1 (a varchar(150) NOT NULL, KEY (a)); 446INSERT t1 VALUES ("can \tcan"); 447INSERT t1 VALUES ("can can"); 448INSERT t1 VALUES ("can"); 449SELECT * FROM t1; 450CHECK TABLE t1; 451DROP TABLE t1; 452 453# 454# Verify blob handling 455# 456create table t1 (a blob); 457insert into t1 values('a '),('a'); 458select concat(a,'.') from t1 where a='a'; 459select concat(a,'.') from t1 where a='a '; 460alter table t1 add key(a(2)); 461select concat(a,'.') from t1 where a='a'; 462select concat(a,'.') from t1 where a='a '; 463drop table t1; 464 465# 466# Test text and unique 467# 468create table t1 (a int not null auto_increment primary key, b text not null, unique b (b(20))); 469insert into t1 (b) values ('a'),('b'),('c'); 470select concat(b,'.') from t1; 471update t1 set b='b ' where a=2; 472--error ER_DUP_ENTRY 473update t1 set b='b ' where a > 1; 474--error ER_DUP_ENTRY 475insert into t1 (b) values ('b'); 476select * from t1; 477delete from t1 where b='b'; 478select a,concat(b,'.') from t1; 479drop table t1; 480 481# 482# Test keys with 0 segments. (Bug #3203) 483# 484create table t1 (a int not null); 485create table t2 (a int not null, primary key (a)); 486insert into t1 values (1); 487insert into t2 values (1),(2); 488select sql_big_result distinct t1.a from t1,t2 order by t2.a; 489select distinct t1.a from t1,t2 order by t2.a; 490select sql_big_result distinct t1.a from t1,t2; 491explain select sql_big_result distinct t1.a from t1,t2 order by t2.a; 492explain select distinct t1.a from t1,t2 order by t2.a; 493drop table t1,t2; 494 495# 496# Bug#14616 - Freshly imported table returns error 124 when using LIMIT 497# 498create table t1 ( 499 c1 varchar(32), 500 key (c1) 501) engine=myisam; 502alter table t1 disable keys; 503insert into t1 values ('a'), ('b'); 504select c1 from t1 order by c1 limit 1; 505drop table t1; 506 507# 508# Bug #14400 Join could miss concurrently inserted row 509# 510# Partial key. 511create table t1 (a int not null, primary key(a)); 512create table t2 (a int not null, b int not null, primary key(a,b)); 513insert into t1 values (1),(2),(3),(4),(5),(6); 514insert into t2 values (1,1),(2,1); 515lock tables t1 read local, t2 read local; 516select straight_join * from t1,t2 force index (primary) where t1.a=t2.a; 517connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); 518insert into t2 values(2,0); 519disconnect root; 520connection default; 521select straight_join * from t1,t2 force index (primary) where t1.a=t2.a; 522unlock tables; 523drop table t1,t2; 524# 525# Full key. 526CREATE TABLE t1 (c1 varchar(250) NOT NULL); 527CREATE TABLE t2 (c1 varchar(250) NOT NULL, PRIMARY KEY (c1)); 528INSERT INTO t1 VALUES ('test000001'), ('test000002'), ('test000003'); 529INSERT INTO t2 VALUES ('test000002'), ('test000003'), ('test000004'); 530LOCK TABLES t1 READ LOCAL, t2 READ LOCAL; 531SELECT t1.c1 AS t1c1, t2.c1 AS t2c1 FROM t1, t2 532 WHERE t1.c1 = t2.c1 HAVING t1c1 != t2c1; 533connect (con1,localhost,root,,); 534connection con1; 535INSERT INTO t2 VALUES ('test000001'), ('test000005'); 536disconnect con1; 537connection default; 538SELECT t1.c1 AS t1c1, t2.c1 AS t2c1 FROM t1, t2 539 WHERE t1.c1 = t2.c1 HAVING t1c1 != t2c1; 540UNLOCK TABLES; 541DROP TABLE t1,t2; 542 543# End of 4.0 tests 544 545# 546# Test RTREE index 547# 548--error 1235, 1289 549CREATE 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; 550# INSERT INTO t1 VALUES (1,1),(1,1); 551# DELETE FROM rt WHERE a<1; 552# DROP TABLE IF EXISTS t1; 553 554create table t1 (a int, b varchar(200), c text not null) checksum=1; 555create table t2 (a int, b varchar(200), c text not null) checksum=0; 556insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, ""); 557insert t2 select * from t1; 558checksum table t1, t2, t3 quick; 559checksum table t1, t2, t3; 560checksum table t1, t2, t3 extended; 561alter table t1 add d int default 30, add e bigint default 300000, add f decimal(30) default 442; 562checksum table t1; 563#show table status; 564drop table t1,t2; 565 566create table t1 (a int, key (a)); 567show keys from t1; 568alter table t1 disable keys; 569show keys from t1; 570create table t2 (a int); 571let $i=1000; 572set @@rand_seed1=31415926,@@rand_seed2=2718281828; 573--disable_query_log 574begin; 575while ($i) 576{ 577 dec $i; 578 insert t2 values (rand()*100000); 579} 580commit; 581--enable_query_log 582insert t1 select * from t2; 583show keys from t1; 584alter table t1 enable keys; 585show keys from t1; 586alter table t1 engine=heap; 587alter table t1 disable keys; 588show keys from t1; 589drop table t1,t2; 590 591# 592# index search for NULL in blob. Bug #4816 593# 594create table t1 ( a tinytext, b char(1), index idx (a(1),b) ); 595insert into t1 values (null,''), (null,''); 596explain select count(*) from t1 where a is null; 597select count(*) from t1 where a is null; 598drop table t1; 599 600# 601# bug9188 - Corruption Can't open file: 'table.MYI' (errno: 145) 602# 603create table t1 (c1 int, c2 varchar(4) not null default '', 604 key(c2(3))) default charset=utf8; 605insert into t1 values (1,'A'), (2, 'B'), (3, 'A'); 606update t1 set c2='A B' where c1=2; 607check table t1; 608drop table t1; 609 610 611# 612# Bug#12296 - CHECKSUM TABLE reports 0 for the table 613# This happened if the first record was marked as deleted. 614# 615create table t1 (c1 int); 616insert into t1 values (1),(2),(3),(4); 617checksum table t1; 618delete from t1 where c1 = 1; 619create table t2 as select * from t1; 620# The following returns 0 with the bug in place. 621checksum table t1; 622# The above should give the same number as the following. 623checksum table t2; 624drop table t1, t2; 625 626# 627# BUG#12232: New myisam_stats_method variable. 628# 629 630show variables like 'myisam_stats_method'; 631 632create table t1 (a int, key(a)); 633insert into t1 values (0),(1),(2),(3),(4); 634insert into t1 select NULL from t1; 635 636# default: NULLs considered inequal 637analyze table t1; 638show index from t1; 639insert into t1 values (11); 640delete from t1 where a=11; 641check table t1; 642show index from t1; 643 644# Set nulls to be equal: 645set myisam_stats_method=nulls_equal; 646 647set @save_use_stat_tables = @@use_stat_tables; 648set @@use_stat_tables = COMPLEMENTARY; 649show variables like 'myisam_stats_method'; 650insert into t1 values (11); 651delete from t1 where a=11; 652 653analyze table t1; 654show index from t1; 655 656insert into t1 values (11); 657delete from t1 where a=11; 658 659check table t1; 660show index from t1; 661 662# Set nulls back to be equal 663set @@use_stat_tables = @save_use_stat_tables; 664set myisam_stats_method=DEFAULT; 665show variables like 'myisam_stats_method'; 666insert into t1 values (11); 667delete from t1 where a=11; 668 669analyze table t1; 670show index from t1; 671 672insert into t1 values (11); 673delete from t1 where a=11; 674 675check table t1; 676show index from t1; 677 678drop table t1; 679 680# WL#2609, CSC#XXXX: MyISAM 681set myisam_stats_method=nulls_ignored; 682show variables like 'myisam_stats_method'; 683 684set @save_use_stat_tables = @@use_stat_tables; 685set @@use_stat_tables = COMPLEMENTARY; 686 687create table t1 ( 688 a char(3), b char(4), c char(5), d char(6), 689 key(a,b,c,d) 690); 691insert into t1 values ('bcd','def1', NULL, 'zz'); 692insert into t1 values ('bcd','def2', NULL, 'zz'); 693insert into t1 values ('bce','def1', 'yuu', NULL); 694insert into t1 values ('bce','def2', NULL, 'quux'); 695analyze table t1; 696show index from t1; 697delete from t1; 698analyze table t1; 699show index from t1; 700 701set myisam_stats_method=DEFAULT; 702drop table t1; 703set @@use_stat_tables = @save_use_stat_tables; 704 705# BUG#13814 - key value packed incorrectly for TINYBLOBs 706 707create table t1( 708 cip INT NOT NULL, 709 time TIME NOT NULL, 710 score INT NOT NULL DEFAULT 0, 711 bob TINYBLOB 712); 713 714insert into t1 (cip, time) VALUES (1, '00:01'), (2, '00:02'), (3,'00:03'); 715insert into t1 (cip, bob, time) VALUES (4, 'a', '00:04'), (5, 'b', '00:05'), 716 (6, 'c', '00:06'); 717select * from t1 where bob is null and cip=1; 718create index bug on t1 (bob(22), cip, time); 719select * from t1 where bob is null and cip=1; 720drop table t1; 721 722# 723# Bug#14980 - COUNT(*) incorrect on MyISAM table with certain INDEX 724# 725create table t1 ( 726 id1 int not null auto_increment, 727 id2 int not null default '0', 728 t text not null, 729 primary key (id1), 730 key x (id2, t(32)) 731) engine=myisam; 732insert into t1 (id2, t) values 733(10, 'abc'), (10, 'abc'), (10, 'abc'), 734(20, 'abc'), (20, 'abc'), (20, 'def'), 735(10, 'abc'), (10, 'abc'); 736select count(*) from t1 where id2 = 10; 737select count(id1) from t1 where id2 = 10; 738drop table t1; 739 740# 741# BUG##20357 - Got error 124 from storage engine using MIN and MAX functions 742# in queries 743# 744CREATE TABLE t1(a TINYINT, KEY(a)) ENGINE=MyISAM; 745INSERT INTO t1 VALUES(1); 746SELECT MAX(a) FROM t1 IGNORE INDEX(a); 747ALTER TABLE t1 DISABLE KEYS; 748SELECT MAX(a) FROM t1; 749SELECT MAX(a) FROM t1 IGNORE INDEX(a); 750DROP TABLE t1; 751 752# 753# BUG#18036 - update of table joined to self reports table as crashed 754# 755CREATE TABLE t1(a CHAR(9), b VARCHAR(7)) ENGINE=MyISAM; 756INSERT INTO t1(a) VALUES('xxxxxxxxx'),('xxxxxxxxx'); 757UPDATE t1 AS ta1,t1 AS ta2 SET ta1.b='aaaaaa',ta2.b='bbbbbb'; 758SELECT * FROM t1; 759DROP TABLE t1; 760 761# 762# Bug#8283 - OPTIMIZE TABLE causes data loss 763# 764SET @@myisam_repair_threads=2; 765SHOW VARIABLES LIKE 'myisam_repair%'; 766# 767# Test OPTIMIZE. This creates a new data file. 768CREATE TABLE t1 ( 769 `_id` int(11) NOT NULL default '0', 770 `url` text, 771 `email` text, 772 `description` text, 773 `loverlap` int(11) default NULL, 774 `roverlap` int(11) default NULL, 775 `lneighbor_id` int(11) default NULL, 776 `rneighbor_id` int(11) default NULL, 777 `length_` int(11) default NULL, 778 `sequence` mediumtext, 779 `name` text, 780 `_obj_class` text NOT NULL, 781 PRIMARY KEY (`_id`), 782 UNIQUE KEY `sequence_name_index` (`name`(50)), 783 KEY (`length_`) 784) ENGINE=MyISAM DEFAULT CHARSET=latin1; 785# 786INSERT INTO t1 VALUES 787 (1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample1',''), 788 (2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample2',''), 789 (3,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample3',''), 790 (4,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample4',''), 791 (5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample5',''), 792 (6,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample6',''), 793 (7,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample7',''), 794 (8,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample8',''), 795 (9,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample9',''); 796# 797SELECT _id FROM t1; 798DELETE FROM t1 WHERE _id < 8; 799SELECT table_name, engine, version, row_format, Table_rows, Data_free, create_options, table_comment FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' and TABLE_NAME='t1'; 800CHECK TABLE t1 EXTENDED; 801OPTIMIZE TABLE t1; 802CHECK TABLE t1 EXTENDED; 803SELECT table_name, engine, version, row_format, Table_rows, Data_free, create_options, table_comment FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' and TABLE_NAME='t1'; 804SELECT _id FROM t1; 805DROP TABLE t1; 806# 807# Test REPAIR QUICK. This retains the old data file. 808CREATE TABLE t1 ( 809 `_id` int(11) NOT NULL default '0', 810 `url` text, 811 `email` text, 812 `description` text, 813 `loverlap` int(11) default NULL, 814 `roverlap` int(11) default NULL, 815 `lneighbor_id` int(11) default NULL, 816 `rneighbor_id` int(11) default NULL, 817 `length_` int(11) default NULL, 818 `sequence` mediumtext, 819 `name` text, 820 `_obj_class` text NOT NULL, 821 PRIMARY KEY (`_id`), 822 UNIQUE KEY `sequence_name_index` (`name`(50)), 823 KEY (`length_`) 824) ENGINE=MyISAM DEFAULT CHARSET=latin1; 825# 826INSERT INTO t1 VALUES 827 (1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample1',''), 828 (2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample2',''), 829 (3,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample3',''), 830 (4,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample4',''), 831 (5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample5',''), 832 (6,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample6',''), 833 (7,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample7',''), 834 (8,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample8',''), 835 (9,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample9',''); 836# 837SELECT _id FROM t1; 838DELETE FROM t1 WHERE _id < 8; 839SELECT table_name, engine, version, row_format, Table_rows, Data_free, create_options, table_comment FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' and TABLE_NAME='t1'; 840CHECK TABLE t1 EXTENDED; 841REPAIR TABLE t1 QUICK; 842CHECK TABLE t1 EXTENDED; 843SELECT table_name, engine, version, row_format, Table_rows, Data_free, create_options, table_comment FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' and TABLE_NAME='t1'; 844SELECT _id FROM t1; 845DROP TABLE t1; 846# 847SET @@myisam_repair_threads=1; 848SHOW VARIABLES LIKE 'myisam_repair%'; 849 850# 851# BUG#21310 - Trees in SQL causing a "crashed" table with MyISAM storage 852# engine 853# 854 855# A simplified test case that reflect crashed table issue. 856CREATE TABLE t1(a VARCHAR(16)); 857INSERT INTO t1 VALUES('aaaaaaaa'),(NULL); 858UPDATE t1 AS ta1, t1 AS ta2 SET ta1.a='aaaaaaaaaaaaaaaa'; 859SELECT * FROM t1; 860DROP TABLE t1; 861 862# A test case that reflect wrong result set. 863CREATE TABLE t1(a INT); 864INSERT INTO t1 VALUES(1),(2); 865UPDATE t1,t1 AS t2 SET t1.a=t1.a+2 WHERE t1.a=t2.a-1; 866SELECT * FROM t1 ORDER BY a; 867DROP TABLE t1; 868 869# 870# Bug#24607 - MyISAM pointer size determined incorrectly 871# 872CREATE TABLE t1 (c1 TEXT) AVG_ROW_LENGTH=70100 MAX_ROWS=4100100100; 873SELECT table_name, engine, version, row_format, max_data_length, max_index_length, create_options, table_comment FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' and TABLE_NAME='t1'; 874DROP TABLE t1; 875 876# 877# Bug#26231 - select count(*) on myisam table returns wrong value 878# when index is used 879# 880CREATE TABLE t1 (c1 TEXT NOT NULL, KEY c1 (c1(10))) ENGINE=MyISAM; 881# Fill at least two key blocks. "Tab, A" must be in both blocks. 882INSERT INTO t1 VALUES 883 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 884 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 885 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 886 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 887 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 888 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 889 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 890 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 891 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 892 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 893 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 894 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 895 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 896 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 897 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 898 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 899 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 900 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 901 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 902 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 903 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 904 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 905 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 906 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 907 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 908 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 909 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 910 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 911 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 912 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 913 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 914 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 915 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 916 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 917 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 918 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 919 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 920 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 921 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 922 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 923 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 924 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 925 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 926 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 927 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 928 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 929 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 930 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 931 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 932 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 933 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 934 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 935 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 936 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 937 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 938 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 939 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 940 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 941 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 942 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 943 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 944 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 945 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 946 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 947 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 948 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 949 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 950 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 951 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 952 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 953 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 954 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 955 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 956 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 957 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 958 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 959 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 960 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 961 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 962 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 963 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 964 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 965 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 966 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 967 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 968 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 969 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 970 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 971 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 972 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 973 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 974 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 975 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 976 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 977 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 978 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 979 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 980 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 981 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 982 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 983 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 984 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 985 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 986 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 987 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 988 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 989 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 990 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 991 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 992 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 993 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 994 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 995 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 996 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 997 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 998 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 999 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 1000 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 1001 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 1002 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 1003 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 1004 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 1005 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 1006 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 1007 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 1008 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 1009 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 1010 (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), 1011 (''), (''), (''), (''), 1012 (' B'), (' B'), (' B'), (' B'); 1013SELECT DISTINCT COUNT(*) FROM t1 WHERE c1 = ''; 1014SELECT DISTINCT length(c1), c1 FROM t1 WHERE c1 = ''; 1015SELECT DISTINCT COUNT(*) FROM t1 IGNORE INDEX (c1) WHERE c1 = ''; 1016SELECT DISTINCT length(c1), c1 FROM t1 IGNORE INDEX (c1) WHERE c1 = ''; 1017SELECT DISTINCT length(c1), c1 FROM t1 ORDER BY c1; 1018DROP TABLE t1; 1019 1020--echo End of 4.1 tests 1021 1022 1023# Test varchar 1024# 1025 1026let $default=`select @@storage_engine`; 1027set storage_engine=MyISAM; 1028source include/varchar.inc; 1029 1030# 1031# Some errors/warnings on create 1032# 1033 1034create table t1 (v varchar(65530), key(v)); 1035drop table if exists t1; 1036set statement sql_mode = 'NO_ENGINE_SUBSTITUTION' for 1037create table t1 (v varchar(65536)); 1038show create table t1; 1039drop table t1; 1040set statement sql_mode = 'NO_ENGINE_SUBSTITUTION' for 1041create table t1 (v varchar(65530) character set utf8); 1042show create table t1; 1043drop table t1; 1044 1045# MyISAM specific varchar tests 1046set statement sql_mode='' for 1047create table t1 (v varchar(65535)); 1048show create table t1; 1049drop table t1; 1050 1051eval set storage_engine=$default; 1052 1053# 1054# Test concurrent insert 1055# First with static record length 1056# 1057set @save_concurrent_insert=@@concurrent_insert; 1058set global concurrent_insert=1; 1059create table t1 (a int); 1060insert into t1 values (1),(2),(3),(4),(5); 1061lock table t1 read local; 1062connect (con1,localhost,root,,); 1063connection con1; 1064# Insert in table without hole 1065insert into t1 values(6),(7); 1066connection default; 1067unlock tables; 1068delete from t1 where a>=3 and a<=4; 1069lock table t1 read local; 1070connection con1; 1071set global concurrent_insert=2; 1072# Insert in table with hole -> Should insert at end 1073insert into t1 values (8),(9); 1074connection default; 1075unlock tables; 1076# Insert into hole 1077insert into t1 values (10),(11),(12); 1078select * from t1; 1079check table t1; 1080drop table t1; 1081disconnect con1; 1082 1083# Same test with dynamic record length 1084create table t1 (a int, b varchar(30) default "hello"); 1085insert into t1 (a) values (1),(2),(3),(4),(5); 1086lock table t1 read local; 1087connect (con1,localhost,root,,); 1088connection con1; 1089# Insert in table without hole 1090insert into t1 (a) values(6),(7); 1091connection default; 1092unlock tables; 1093delete from t1 where a>=3 and a<=4; 1094lock table t1 read local; 1095connection con1; 1096set global concurrent_insert=2; 1097# Insert in table with hole -> Should insert at end 1098insert into t1 (a) values (8),(9); 1099connection default; 1100unlock tables; 1101# Insert into hole 1102insert into t1 (a) values (10),(11),(12); 1103select a from t1; 1104check table t1; 1105drop table t1; 1106disconnect con1; 1107set global concurrent_insert=@save_concurrent_insert; 1108 1109 1110# BUG#9622 - ANALYZE TABLE and ALTER TABLE .. ENABLE INDEX produce 1111# different statistics on the same table with NULL values. 1112create table t1 (a int, key(a)); 1113 1114insert into t1 values (1),(2),(3),(4),(NULL),(NULL),(NULL),(NULL); 1115analyze table t1; 1116show keys from t1; 1117 1118alter table t1 disable keys; 1119alter table t1 enable keys; 1120show keys from t1; 1121 1122drop table t1; 1123 1124 1125# 1126# Bug#10056 - PACK_KEYS option take values greater than 1 while creating table 1127# 1128create table t1 (c1 int) engine=myisam pack_keys=0; 1129create table t2 (c1 int) engine=myisam pack_keys=1; 1130create table t3 (c1 int) engine=myisam pack_keys=default; 1131--error 1064 1132create table t4 (c1 int) engine=myisam pack_keys=2; 1133drop table t1, t2, t3; 1134 1135 1136# 1137# Bug#28476: force index on a disabled myisam index gives error 124 1138# 1139CREATE TABLE t1(a INT, b INT, KEY inx (a), UNIQUE KEY uinx (b)) ENGINE=MyISAM; 1140INSERT INTO t1(a,b) VALUES (1,1),(2,2),(3,3),(4,4),(5,5); 1141SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1; 1142ALTER TABLE t1 DISABLE KEYS; 1143SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1; 1144SELECT a FROM t1 USE INDEX (inx) WHERE a=1; 1145SELECT b FROM t1 FORCE INDEX (uinx) WHERE b=1; 1146SELECT b FROM t1 USE INDEX (uinx) WHERE b=1; 1147SELECT a FROM t1 FORCE INDEX (inx,uinx) WHERE a=1; 1148ALTER TABLE t1 ENABLE KEYS; 1149SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1; 1150DROP TABLE t1; 1151 1152# 1153# Bug#4692 - DISABLE/ENABLE KEYS waste a space 1154# 1155CREATE TABLE t1 (c1 INT, c2 INT, UNIQUE INDEX (c1), INDEX (c2)) ENGINE=MYISAM; 1156--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 # 19 # 1157SHOW TABLE STATUS LIKE 't1'; 1158INSERT INTO t1 VALUES (1,1); 1159--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 # 19 # 1160SHOW TABLE STATUS LIKE 't1'; 1161ALTER TABLE t1 DISABLE KEYS; 1162--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 # 19 # 1163SHOW TABLE STATUS LIKE 't1'; 1164ALTER TABLE t1 ENABLE KEYS; 1165--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 # 19 # 1166SHOW TABLE STATUS LIKE 't1'; 1167ALTER TABLE t1 DISABLE KEYS; 1168--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 # 19 # 1169SHOW TABLE STATUS LIKE 't1'; 1170ALTER TABLE t1 ENABLE KEYS; 1171--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 # 19 # 1172SHOW TABLE STATUS LIKE 't1'; 1173#--exec ls -log var/master-data/test/t1.MYI 1174#--exec myisamchk -dvv var/master-data/test/t1.MYI 1175#--exec myisamchk -iev var/master-data/test/t1.MYI 1176--echo # Enable keys with parallel repair 1177SET @@myisam_repair_threads=2; 1178ALTER TABLE t1 DISABLE KEYS; 1179ALTER TABLE t1 ENABLE KEYS; 1180SET @@myisam_repair_threads=1; 1181CHECK TABLE t1 EXTENDED; 1182DROP TABLE t1; 1183 1184# 1185# Bug#28837: MyISAM storage engine error (134) doing delete with self-join 1186# 1187 1188CREATE TABLE t1 (id int NOT NULL, ref int NOT NULL, INDEX (id)) ENGINE=MyISAM; 1189CREATE TABLE t2 LIKE t1; 1190 1191INSERT INTO t2 (id, ref) VALUES (1,3), (2,1), (3,2), (4,5), (4,4); 1192INSERT INTO t1 SELECT * FROM t2; 1193 1194SELECT * FROM t1 AS a INNER JOIN t1 AS b USING (id) WHERE a.ref < b.ref; 1195SELECT * FROM t1; 1196DELETE FROM a USING t1 AS a INNER JOIN t1 AS b USING (id) WHERE a.ref < b.ref; 1197SELECT * FROM t1; 1198 1199DROP TABLE t1, t2; 1200 1201 1202# 1203# Bug#37310: 'on update CURRENT_TIMESTAMP' option crashes the table 1204# 1205CREATE TABLE t1 (a INT) ENGINE=MyISAM CHECKSUM=1 ROW_FORMAT=DYNAMIC; 1206INSERT INTO t1 VALUES (0); 1207UPDATE t1 SET a=1; 1208SELECT a FROM t1; 1209CHECK TABLE t1; 1210INSERT INTO t1 VALUES (0), (5), (4), (2); 1211UPDATE t1 SET a=2; 1212SELECT a FROM t1; 1213CHECK TABLE t1; 1214DROP TABLE t1; 1215 1216 1217--echo # 1218--echo # Bug #49465: valgrind warnings and incorrect live checksum... 1219--echo # 1220CREATE TABLE t1( 1221a VARCHAR(1), b VARCHAR(1), c VARCHAR(1), 1222f VARCHAR(1), g VARCHAR(1), h VARCHAR(1), 1223i VARCHAR(1), j VARCHAR(1), k VARCHAR(1)) CHECKSUM=1; 1224INSERT INTO t1 VALUES('', '', '', '', '', '', '', '', ''); 1225CHECKSUM TABLE t1 QUICK; 1226CHECKSUM TABLE t1 EXTENDED; 1227DROP TABLE t1; 1228 1229 1230--echo # 1231--echo # BUG#48438 - crash with error in unioned query against merge table and view... 1232--echo # 1233SET @save_table_open_cache=@@table_open_cache; 1234SET GLOBAL table_open_cache=10; 1235CREATE TABLE t1(a INT); 1236SELECT 1 FROM t1 AS a1, t1 AS a2, t1 AS a3, t1 AS a4, t1 AS a5, t1 AS a6, t1 AS a7, t1 AS a8, t1 AS a9, t1 AS a10, t1 AS a11 FOR UPDATE; 1237SELECT TABLE_ROWS, DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES 1238 WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; 1239DROP TABLE t1; 1240SET GLOBAL table_open_cache=@save_table_open_cache; 1241 1242--echo End of 5.0 tests 1243 1244 1245# 1246# Test of key_block_size 1247# 1248 1249create table t1 (a int not null, key `a` (a) key_block_size=1024); 1250show create table t1; 1251drop table t1; 1252 1253create table t1 (a int not null, key `a` (a) key_block_size=2048); 1254show create table t1; 1255drop table t1; 1256 1257create table t1 (a varchar(2048), key `a` (a)); 1258show create table t1; 1259drop table t1; 1260 1261create table t1 (a varchar(2048), key `a` (a) key_block_size=1024); 1262show create table t1; 1263drop table t1; 1264 1265create table t1 (a int not null, b varchar(2048), key (a), key(b)) key_block_size=1024; 1266show create table t1; 1267alter table t1 key_block_size=2048; 1268show create table t1; 1269alter table t1 add c int, add key (c); 1270show create table t1; 1271alter table t1 key_block_size=0; 1272alter table t1 add d int, add key (d); 1273show create table t1; 1274drop table t1; 1275 1276create table t1 (a int not null, b varchar(2048), key (a), key(b)) key_block_size=8192; 1277show create table t1; 1278drop table t1; 1279 1280create table t1 (a int not null, b varchar(512), key (a), key(b)); 1281show create table t1; 1282alter table t1 key_block_size=2048; 1283show create table t1; 1284alter table t1 add c int, add key (c); 1285show create table t1; 1286alter table t1 key_block_size=4096; 1287show create table t1; 1288alter table t1 key_block_size=0; 1289show create table t1; 1290alter table t1 add d int, add key (d); 1291show create table t1; 1292alter table t1 key_block_size=8192; 1293show create table t1; 1294drop table t1; 1295 1296create table t1 (a int not null, b varchar(2048), key (a) key_block_size=1024, key(b)) key_block_size=8192; 1297show create table t1; 1298drop table t1; 1299 1300create table t1 (a int not null, b int, key (a) key_block_size=1024, key(b) key_block_size=8192) key_block_size=16384; 1301show create table t1; 1302drop table t1; 1303 1304# Test limits and errors of key_block_size 1305 1306create table t1 (a int not null, key `a` (a) key_block_size=512); 1307show create table t1; 1308drop table t1; 1309 1310create table t1 (a varchar(2048), key `a` (a) key_block_size=1000000000000000000); 1311show create table t1; 1312drop table t1; 1313 1314create table t1 (a int not null, key `a` (a) key_block_size=1025); 1315show create table t1; 1316drop table t1; 1317 1318--error 1064 1319create table t1 (a int not null, key key_block_size=1024 (a)); 1320--error 1064 1321create table t1 (a int not null, key `a` key_block_size=1024 (a)); 1322 1323# 1324# Bug#22119 - Changing MI_KEY_BLOCK_LENGTH makes a wrong myisamchk 1325# 1326CREATE TABLE t1 ( 1327 c1 INT, 1328 c2 VARCHAR(300), 1329 KEY (c1) KEY_BLOCK_SIZE 1024, 1330 KEY (c2) KEY_BLOCK_SIZE 8192 1331 ); 1332INSERT INTO t1 VALUES (10, REPEAT('a', CEIL(RAND(10) * 300))), 1333 (11, REPEAT('b', CEIL(RAND() * 300))), 1334 (12, REPEAT('c', CEIL(RAND() * 300))), 1335 (13, REPEAT('d', CEIL(RAND() * 300))), 1336 (14, REPEAT('e', CEIL(RAND() * 300))), 1337 (15, REPEAT('f', CEIL(RAND() * 300))), 1338 (16, REPEAT('g', CEIL(RAND() * 300))), 1339 (17, REPEAT('h', CEIL(RAND() * 300))), 1340 (18, REPEAT('i', CEIL(RAND() * 300))), 1341 (19, REPEAT('j', CEIL(RAND() * 300))), 1342 (20, REPEAT('k', CEIL(RAND() * 300))), 1343 (21, REPEAT('l', CEIL(RAND() * 300))), 1344 (22, REPEAT('m', CEIL(RAND() * 300))), 1345 (23, REPEAT('n', CEIL(RAND() * 300))), 1346 (24, REPEAT('o', CEIL(RAND() * 300))), 1347 (25, REPEAT('p', CEIL(RAND() * 300))), 1348 (26, REPEAT('q', CEIL(RAND() * 300))), 1349 (27, REPEAT('r', CEIL(RAND() * 300))), 1350 (28, REPEAT('s', CEIL(RAND() * 300))), 1351 (29, REPEAT('t', CEIL(RAND() * 300))), 1352 (30, REPEAT('u', CEIL(RAND() * 300))), 1353 (31, REPEAT('v', CEIL(RAND() * 300))), 1354 (32, REPEAT('w', CEIL(RAND() * 300))), 1355 (33, REPEAT('x', CEIL(RAND() * 300))), 1356 (34, REPEAT('y', CEIL(RAND() * 300))), 1357 (35, REPEAT('z', CEIL(RAND() * 300))); 1358INSERT INTO t1 SELECT * FROM t1; 1359INSERT INTO t1 SELECT * FROM t1; 1360CHECK TABLE t1; 1361REPAIR TABLE t1; 1362DELETE FROM t1 WHERE c1 >= 10; 1363CHECK TABLE t1; 1364DROP TABLE t1; 1365 1366# 1367# Bug#33222 - myisam-table drops rows when column is added 1368# and a char-field > 128 exists 1369# 1370# Test #1 - CHECK TABLE sees wrong record, REPAR TABLE deletes it. 1371# Using a CHAR column that can have > 127 characters. 1372# Using a VARCHAR to create a table with dynamic row format. 1373CREATE TABLE t1 ( 1374 c1 CHAR(130), 1375 c2 VARCHAR(1) 1376) ENGINE=MyISAM; 1377INSERT INTO t1 VALUES(REPEAT("a",128), 'b'); 1378SELECT COUNT(*) FROM t1; 1379CHECK TABLE t1; 1380REPAIR TABLE t1; 1381SELECT COUNT(*) FROM t1; 1382CHECK TABLE t1; 1383DROP TABLE t1; 1384# 1385# Test #2 - same as test #1, but using EXTENDED. 1386# Using a CHAR column that can have > 127 characters. 1387# Using a VARCHAR to create a table with dynamic row format. 1388CREATE TABLE t1 ( 1389 c1 CHAR(130), 1390 c2 VARCHAR(1) 1391) ENGINE=MyISAM; 1392INSERT INTO t1 VALUES(REPEAT("a",128), 'b'); 1393SELECT COUNT(*) FROM t1; 1394CHECK TABLE t1 EXTENDED; 1395REPAIR TABLE t1 EXTENDED; 1396SELECT COUNT(*) FROM t1; 1397CHECK TABLE t1 EXTENDED; 1398DROP TABLE t1; 1399# 1400# Test #3 - same as test #1, but using OPTIMIZE TABLE. 1401# Using a CHAR column that can have > 127 characters. 1402# Using a VARCHAR to create a table with dynamic row format. 1403CREATE TABLE t1 ( 1404 c1 CHAR(130), 1405 c2 VARCHAR(1) 1406) ENGINE=MyISAM; 1407INSERT INTO t1 VALUES(REPEAT("a",128), 'b'); 1408# Insert more rows and delete one in the middle to force optimize. 1409INSERT INTO t1 VALUES('b', 'b'); 1410INSERT INTO t1 VALUES('c', 'b'); 1411DELETE FROM t1 WHERE c1='b'; 1412SELECT COUNT(*) FROM t1; 1413OPTIMIZE TABLE t1; 1414SELECT COUNT(*) FROM t1; 1415DROP TABLE t1; 1416# 1417# Test #4 - ALTER TABLE deletes rows. 1418# Using a CHAR column that can have > 127 characters. 1419# Using a VARCHAR to create a table with dynamic row format. 1420# Using an index which can be disabled during bulk insert. 1421CREATE TABLE t1 ( 1422 c1 CHAR(130), 1423 c2 VARCHAR(1), 1424 KEY (c1) 1425) ENGINE=MyISAM; 1426# 1427# Insert 100 rows. This turns bulk insert on during the copy phase of 1428# ALTER TABLE. Bulk insert disables keys before the insert and re-enables 1429# them by repair after the insert. 1430--disable_query_log 1431let $count= 100; 1432--echo # Insert $count rows. Query log disabled. 1433begin; 1434while ($count) 1435{ 1436 INSERT INTO t1 VALUES ('a', 'b'); 1437 dec $count; 1438} 1439commit; 1440--enable_query_log 1441# 1442# Change most of the rows into long character values with > 127 characters. 1443UPDATE t1 SET c1=REPEAT("a",128) LIMIT 90; 1444SELECT COUNT(*) FROM t1; 1445ALTER TABLE t1 ENGINE=MyISAM; 1446# 1447# With bug present, this shows that all long rows are gone. 1448SELECT COUNT(*) FROM t1; 1449CHECK TABLE t1; 1450CHECK TABLE t1 EXTENDED; 1451DROP TABLE t1; 1452# 1453# Test #5 - same as test #1 but UTF-8. 1454# Using a CHAR column that can have > 127 characters. 1455# Using a VARCHAR to create a table with dynamic row format. 1456CREATE TABLE t1 ( 1457 c1 CHAR(50), 1458 c2 VARCHAR(1) 1459) ENGINE=MyISAM DEFAULT CHARSET UTF8; 1460# Using Tamil Letter A, Unicode U+0B85 1461INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b'); 1462SELECT COUNT(*) FROM t1; 1463CHECK TABLE t1; 1464REPAIR TABLE t1; 1465SELECT COUNT(*) FROM t1; 1466CHECK TABLE t1; 1467DROP TABLE t1; 1468# 1469# Test #6 - same as test #2, but UTF-8. 1470# Using a CHAR column that can have > 127 characters. 1471# Using a VARCHAR to create a table with dynamic row format. 1472CREATE TABLE t1 ( 1473 c1 CHAR(50), 1474 c2 VARCHAR(1) 1475) ENGINE=MyISAM DEFAULT CHARSET UTF8; 1476# Using Tamil Letter A, Unicode U+0B85 1477INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b'); 1478SELECT COUNT(*) FROM t1; 1479CHECK TABLE t1 EXTENDED; 1480REPAIR TABLE t1 EXTENDED; 1481SELECT COUNT(*) FROM t1; 1482CHECK TABLE t1 EXTENDED; 1483DROP TABLE t1; 1484# 1485# Test #7 - same as test #3, but UTF-8. 1486# Using a CHAR column that can have > 127 characters. 1487# Using a VARCHAR to create a table with dynamic row format. 1488CREATE TABLE t1 ( 1489 c1 CHAR(50), 1490 c2 VARCHAR(1) 1491) ENGINE=MyISAM DEFAULT CHARSET UTF8; 1492# Using Tamil Letter A, Unicode U+0B85 1493INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b'); 1494# Insert more rows and delete one in the middle to force optimize. 1495INSERT INTO t1 VALUES('b', 'b'); 1496INSERT INTO t1 VALUES('c', 'b'); 1497DELETE FROM t1 WHERE c1='b'; 1498SELECT COUNT(*) FROM t1; 1499OPTIMIZE TABLE t1; 1500SELECT COUNT(*) FROM t1; 1501DROP TABLE t1; 1502# 1503# Test #8 - same as test #4, but UTF-8. 1504# Using a CHAR column that can have > 42 UTF-8 characters. 1505# Using a VARCHAR to create a table with dynamic row format. 1506# Using an index which can be disabled during bulk insert. 1507CREATE TABLE t1 ( 1508 c1 CHAR(50), 1509 c2 VARCHAR(1), 1510 KEY (c1) 1511) ENGINE=MyISAM DEFAULT CHARSET UTF8; 1512# 1513# Insert 100 rows. This turns bulk insert on during the copy phase of 1514# ALTER TABLE. Bulk insert disables keys before the insert and re-enables 1515# them by repair after the insert. 1516--disable_query_log 1517let $count= 100; 1518--echo # Insert $count rows. Query log disabled. 1519begin; 1520while ($count) 1521{ 1522 INSERT INTO t1 VALUES ('a', 'b'); 1523 dec $count; 1524} 1525commit; 1526--enable_query_log 1527# 1528# Change most of the rows into long character values with > 42 characters. 1529# Using Tamil Letter A, Unicode U+0B85 1530UPDATE t1 SET c1=REPEAT(_utf8 x'e0ae85',43) LIMIT 90; 1531SELECT COUNT(*) FROM t1; 1532ALTER TABLE t1 ENGINE=MyISAM; 1533# 1534# With bug present, this shows that all long rows are gone. 1535SELECT COUNT(*) FROM t1; 1536CHECK TABLE t1; 1537CHECK TABLE t1 EXTENDED; 1538DROP TABLE t1; 1539 1540# 1541# Bug#29182 - MyISAMCHK reports wrong character set 1542# 1543CREATE TABLE t1 ( 1544 c1 VARCHAR(10) NOT NULL, 1545 c2 CHAR(10) DEFAULT NULL, 1546 c3 VARCHAR(10) NOT NULL, 1547 KEY (c1), 1548 KEY (c2) 1549) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0; 1550let $MYSQLD_DATADIR= `select @@datadir`; 1551--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR 1552--exec $MYISAMCHK -d $MYSQLD_DATADIR/test/t1 1553DROP TABLE t1; 1554 1555# 1556# Test warnings with transactional=1 with MyISAM 1557# MariaDB: Note that the table will still have 'TRANSACTIONAL=1' attribute. 1558# That's the intended behavior atm. 1559# 1560set statement sql_mode='' for 1561create table t1 (n int not null, c char(1)) transactional=1; 1562show create table t1; 1563drop table t1; 1564 1565# 1566# Test of BUG#35570 CHECKSUM TABLE unreliable if LINESTRING field 1567# (same content / differen checksum) 1568# 1569 1570CREATE TABLE t1 (line LINESTRING NOT NULL) engine=myisam; 1571INSERT INTO t1 VALUES (GeomFromText("LINESTRING(0 0)")); 1572checksum table t1; 1573CREATE TABLE t2 (line LINESTRING NOT NULL) engine=myisam; 1574INSERT INTO t2 VALUES (GeomFromText("LINESTRING(0 0)")); 1575checksum table t2; 1576CREATE TABLE t3 select * from t1; 1577checksum table t3; 1578drop table t1,t2,t3; 1579 1580# 1581# Test number of supported key parts (32 is max) 1582# 1583 1584create table t1 (a1 int,a2 int,a3 int,a4 int,a5 int,a6 int,a7 int,a8 int,a9 int,a10 int,a11 int,a12 int,a13 int,a14 int,a15 int,a16 int,a17 int,a18 int,a19 int,a20 int,a21 int,a22 int,a23 int,a24 int,a25 int,a26 int,a27 int,a28 int,a29 int,a30 int,a31 int,a32 int, 1585key(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32)) engine=myisam; 1586drop table t1; 1587 1588--error 1070 1589create table t1 (a1 int,a2 int,a3 int,a4 int,a5 int,a6 int,a7 int,a8 int,a9 int,a10 int,a11 int,a12 int,a13 int,a14 int,a15 int,a16 int,a17 int,a18 int,a19 int,a20 int,a21 int,a22 int,a23 int,a24 int,a25 int,a26 int,a27 int,a28 int,a29 int,a30 int,a31 int,a32 int, a33 int, 1590key(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33)) engine=myisam; 1591 1592# 1593# Bug#43737: Select query return bad result 1594# 1595CREATE TABLE t1 ( 1596 c INT, 1597 d bit(1), 1598 e INT, 1599 f VARCHAR(1), 1600 g BIT(1), 1601 h BIT(1), 1602 KEY (h, d, e, g) 1603); 1604INSERT INTO t1 VALUES 1605 ( 3, 1, 1, 'a', 0, 0 ), 1606 ( 3, 1, 5, 'a', 0, 0 ), 1607 ( 10, 1, 2, 'a', 0, 1 ), 1608 ( 10, 1, 3, 'a', 0, 1 ), 1609 ( 10, 1, 4, 'a', 0, 1 ); 1610 1611SELECT f FROM t1 WHERE d = 1 AND e = 2 AND g = 0 AND h = 1; 1612 1613SELECT h+0, d + 0, e, g + 0 FROM t1; 1614 1615DROP TABLE t1; 1616 1617# 1618# BUG#47073 - valgrind errs, corruption,failed repair of partition, 1619# low myisam_sort_buffer_size 1620# 1621CREATE TABLE t1(a INT, b CHAR(10), KEY(a), KEY(b)); 1622INSERT INTO t1 VALUES(1,'0'),(2,'0'),(3,'0'),(4,'0'),(5,'0'), 1623 (6,'0'),(7,'0'); 1624INSERT INTO t1 SELECT a+10,b FROM t1; 1625INSERT INTO t1 SELECT a+20,b FROM t1; 1626INSERT INTO t1 SELECT a+40,b FROM t1; 1627INSERT INTO t1 SELECT a+80,b FROM t1; 1628INSERT INTO t1 SELECT a+160,b FROM t1; 1629INSERT INTO t1 SELECT a+320,b FROM t1; 1630INSERT INTO t1 SELECT a+640,b FROM t1; 1631INSERT INTO t1 SELECT a+1280,b FROM t1; 1632INSERT INTO t1 SELECT a+2560,b FROM t1; 1633INSERT INTO t1 SELECT a+5120,b FROM t1; 1634SET myisam_sort_buffer_size=4; 1635--replace_regex /Current myisam_sort_buffer_size.*/X/ 1636REPAIR TABLE t1; 1637 1638SET myisam_repair_threads=2; 1639# May report different values depending on threads activity. 1640--disable_result_log 1641REPAIR TABLE t1; 1642--enable_result_log 1643SET myisam_repair_threads=@@global.myisam_repair_threads; 1644SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size; 1645CHECK TABLE t1; 1646DROP TABLE t1; 1647 1648 1649--echo # 1650--echo # BUG#49628 - corrupt table after legal SQL, LONGTEXT column 1651--echo # 1652CREATE TABLE t1(a INT, b LONGTEXT, UNIQUE(a)); 1653REPLACE INTO t1 VALUES 1654(1, REPEAT('a', 129015)),(1, NULL), 1655(2, NULL),(3, NULL),(4, NULL),(5, NULL),(6, NULL),(7, NULL), 1656(1, REPEAT('b', 129016)),(1, NULL), 1657(1, REPEAT('c', 129015)),(1, REPEAT('d', 129015)); 1658CHECK TABLE t1; 1659DROP TABLE t1; 1660 1661 1662--echo # 1663--echo # Bug#51304: checksum table gives different results 1664--echo # for same data when using bit fields 1665--echo # 1666CREATE TABLE t1(a INT, b BIT(1)); 1667INSERT INTO t1 VALUES(1, 0), (2, 1); 1668CREATE TABLE t2 SELECT * FROM t1; 1669FLUSH TABLES; 1670--copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_DATADIR/test/t3.frm 1671--copy_file $MYSQLD_DATADIR/test/t1.MYD $MYSQLD_DATADIR/test/t3.MYD 1672--copy_file $MYSQLD_DATADIR/test/t1.MYI $MYSQLD_DATADIR/test/t3.MYI 1673CHECKSUM TABLE t1 EXTENDED; 1674CHECKSUM TABLE t2 EXTENDED; 1675CHECKSUM TABLE t3 EXTENDED; 1676DROP TABLE t1, t2, t3; 1677 1678--echo # 1679--echo # BUG#51307 - widespread corruption with partitions and insert...select 1680--echo # 1681CREATE TABLE t1(a CHAR(255), KEY(a)); 1682SELECT * FROM t1, t1 AS a1; 1683SET myisam_sort_buffer_size=4; 1684--replace_regex /Current myisam_sort_buffer_size.*/X/ 1685INSERT INTO t1 VALUES 1686('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), 1687('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), 1688('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), 1689('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), 1690('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), 1691('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), 1692('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), 1693('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), 1694('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), 1695('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), 1696('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), 1697('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), 1698('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), 1699('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), 1700('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), 1701('0'),('0'),('0'),('0'),('0'),('0'),('0'); 1702SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size; 1703INSERT INTO t1 VALUES('1'); 1704SELECT * FROM t1, t1 AS a1 WHERE t1.a=1 AND a1.a=1; 1705DROP TABLE t1; 1706 1707--echo # 1708--echo # BUG#47444 - --myisam_repair_threads>1can result in all index 1709--echo # cardinalities=1 1710--echo # 1711SET myisam_repair_threads=2; 1712SET myisam_sort_buffer_size=4096; 1713CREATE TABLE t1(a CHAR(255), KEY(a), KEY(a), KEY(a)); 1714INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(0),(1),(2),(3); 1715REPAIR TABLE t1; 1716SELECT CARDINALITY FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; 1717DROP TABLE t1; 1718SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size; 1719SET myisam_repair_threads=@@global.myisam_repair_threads; 1720 1721--echo # 1722--echo # BUG#11757032 - 49030: OPTIMIZE TABLE BREAKS MYISAM TABLE WHEN 1723--echo # USING MYISAM_USE_MMAP ON WINDOWS 1724--echo # 1725SET GLOBAL myisam_use_mmap=1; 1726CREATE TABLE t1(a INT); 1727INSERT INTO t1 VALUES(1),(2); 1728DELETE FROM t1 WHERE a=1; 1729FLUSH TABLE t1; 1730LOCK TABLE t1 WRITE; 1731OPTIMIZE TABLE t1; 1732INSERT INTO t1 VALUES(3); 1733UNLOCK TABLES; 1734SELECT * FROM t1; 1735CHECK TABLE t1; 1736DROP TABLE t1; 1737SET GLOBAL myisam_use_mmap=default; 1738 1739--echo # 1740--echo # BUG 11756869 - 48848: MYISAMCHK DOING SORT RECOVER IN CERTAIN 1741--echo # CASES RESETS DATA POINTER TO SMAL 1742--echo # 1743CREATE TABLE t1(a INT, KEY(a)); 1744ALTER TABLE t1 DISABLE KEYS; 1745let $MYSQLD_DATADIR= `select @@datadir`; 1746SET @before:= (SELECT MAX_DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test'); 1747FLUSH TABLES; 1748--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR 1749--exec $MYISAMCHK -sn $MYSQLD_DATADIR/test/t1 1750SET @after:= (SELECT MAX_DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test'); 1751SELECT @before=@after; 1752DROP TABLE t1; 1753--echo End of 5.1 tests 1754 1755--echo # 1756--echo # Bug#51327 MyISAM table is automatically repaired on ALTER 1757--echo # even if myisam-recover is OFF 1758--echo # 1759 1760call mtr.add_suppression("Got an error from thread_id=.*ha_myisam.cc:"); 1761call mtr.add_suppression("MySQL thread id .*, query id .* localhost.*root Checking table"); 1762call mtr.add_suppression(" '\..test.t1'"); 1763 1764let $MYSQLD_DATADIR = `SELECT @@datadir`; 1765--echo # Test that we can exchange a crashed partition with a table 1766SELECT @@global.myisam_recover_options; 1767CREATE TABLE t1 (a INT, KEY (a)) ENGINE=MyISAM; 1768INSERT INTO t1 VALUES (1), (2); 1769FLUSH TABLES; 1770 1771--echo # replacing t.MYI with a corrupt + unclosed one created by doing: 1772--echo # 'create table t1 (a int key(a))' head -c1024 t1.MYI > corrupt_t1.MYI 1773--remove_file $MYSQLD_DATADIR/test/t1.MYI 1774--copy_file std_data/corrupt_t1.MYI $MYSQLD_DATADIR/test/t1.MYI 1775 1776CHECK TABLE t1; 1777--echo # Alter table should report error and not auto-repair the table. 1778# Remove the path to t1 to prevent platform differences 1779--replace_regex /'[^']+'/'t1'/ 1780--error 145 1781ALTER TABLE t1 ENGINE = MyISAM; 1782CHECK TABLE t1; 1783 1784DROP TABLE t1; 1785 1786--echo # 1787--echo # MDEV-3870 - Valgrind warnings on OPTIMIZE MyISAM or Aria TABLE with 1788--echo # disabled keys 1789--echo # 1790CREATE TABLE t1 (a INT, KEY(a)) ENGINE=MyISAM; 1791INSERT INTO t1 VALUES (4),(3),(1),(0); 1792ALTER TABLE t1 DISABLE KEYS; 1793OPTIMIZE TABLE t1; 1794DROP TABLE t1; 1795 1796# 1797# Check FLUSH FOR EXPORT 1798# 1799 1800CREATE TABLE t1(a INT, b CHAR(10), KEY(a), KEY(b)) engine=myisam; 1801INSERT INTO t1 VALUES(1,'0'),(2,'0'),(3,'0'),(4,'0'),(5,'0'), 1802 (6,'0'),(7,'0'); 1803flush tables test.t1 for export; 1804--error ER_TABLE_NOT_LOCKED_FOR_WRITE 1805insert into t1 values (8,'0'); 1806unlock tables; 1807drop table t1; 1808 1809# 1810# Check some variables 1811# 1812show variables like 'myisam_block_size'; 1813select @@global.myisam_block_size; 1814 1815 1816--echo # 1817--echo # MDEV-20704 An index on a double column erroneously uses prefix compression 1818--echo # 1819 1820CREATE TABLE t1 ( 1821 id INT NOT NULL PRIMARY KEY, 1822 d DOUBLE, 1823 KEY (d) 1824) ENGINE=MyISAM; 1825let $MYSQLD_DATADIR= `select @@datadir`; 1826--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR 1827--exec $MYISAMCHK -d $MYSQLD_DATADIR/test/t1 1828DROP TABLE t1; 1829 1830--echo # 1831--echo # End of 5.5 tests 1832--echo # 1833