~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to tests/r/myisam.result

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-10-02 14:17:48 UTC
  • mfrom: (1.1.1 upstream)
  • mto: (2.1.17 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20101002141748-m6vbfbfjhrw1153e
Tags: 2010.09.1802-1
* New upstream release.
* Removed pid-file argument hack.
* Updated GPL-2 address to be new address.
* Directly copy in drizzledump.1 since debian doesn't have sphinx 1.0 yet.
* Link to jquery from libjs-jquery. Add it as a depend.
* Add drizzled.8 symlink to the install files.

Show diffs side-by-side

added added

removed removed

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