| 1 |
SET SESSION DEFAULT_STORAGE_ENGINE = MyISAM; |
| 2 |
drop table if exists t1,t3,t4,t5; |
| 3 |
create table t1 (a int, b char(10), key a using btree (a), key b using btree (a,b)); |
| 4 |
insert into t1 values |
| 5 |
(17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"), |
| 6 |
(14,"aaa"),(16,"ccc"),(16,"xxx"), |
| 7 |
(20,"ggg"),(21,"hhh"),(22,"iii"),(23,"xxx"),(24,"xxx"),(25,"xxx"); |
| 8 |
handler t1 open as t2; |
| 9 |
handler t2 read b first; |
| 10 |
a b |
| 11 |
14 aaa |
| 12 |
handler t2 read b next; |
| 13 |
a b |
| 14 |
16 ccc |
| 15 |
handler t2 read b next; |
| 16 |
a b |
| 17 |
16 xxx |
| 18 |
handler t2 read b prev; |
| 19 |
a b |
| 20 |
16 ccc |
| 21 |
handler t2 read b last; |
| 22 |
a b |
| 23 |
25 xxx |
| 24 |
handler t2 read b prev; |
| 25 |
a b |
| 26 |
24 xxx |
| 27 |
handler t2 read b prev; |
| 28 |
a b |
| 29 |
23 xxx |
| 30 |
handler t2 read b first; |
| 31 |
a b |
| 32 |
14 aaa |
| 33 |
handler t2 read b prev; |
| 34 |
a b |
| 35 |
handler t2 read b last; |
| 36 |
a b |
| 37 |
25 xxx |
| 38 |
handler t2 read b prev; |
| 39 |
a b |
| 40 |
24 xxx |
| 41 |
handler t2 read b next; |
| 42 |
a b |
| 43 |
25 xxx |
| 44 |
handler t2 read b next; |
| 45 |
a b |
| 46 |
handler t2 read a=(15); |
| 47 |
a b |
| 48 |
handler t2 read a=(21); |
| 49 |
a b |
| 50 |
21 hhh |
| 51 |
handler t2 read a=(19,"fff"); |
| 52 |
ERROR 42000: Too many key parts specified; max 1 parts allowed |
| 53 |
handler t2 read b=(19,"fff"); |
| 54 |
a b |
| 55 |
19 fff |
| 56 |
handler t2 read b=(19,"yyy"); |
| 57 |
a b |
| 58 |
19 yyy |
| 59 |
handler t2 read b=(19); |
| 60 |
a b |
| 61 |
19 fff |
| 62 |
handler t1 read a last; |
| 63 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 64 |
handler t2 read a=(11); |
| 65 |
a b |
| 66 |
handler t2 read a>=(11); |
| 67 |
a b |
| 68 |
14 aaa |
| 69 |
handler t2 read b=(18); |
| 70 |
a b |
| 71 |
18 eee |
| 72 |
handler t2 read b>=(18); |
| 73 |
a b |
| 74 |
18 eee |
| 75 |
handler t2 read b>(18); |
| 76 |
a b |
| 77 |
19 fff |
| 78 |
handler t2 read b<=(18); |
| 79 |
a b |
| 80 |
18 eee |
| 81 |
handler t2 read b<(18); |
| 82 |
a b |
| 83 |
17 ddd |
| 84 |
handler t2 read a=(15); |
| 85 |
a b |
| 86 |
handler t2 read a>=(15) limit 2; |
| 87 |
a b |
| 88 |
16 ccc |
| 89 |
16 xxx |
| 90 |
handler t2 read a>(15) limit 2; |
| 91 |
a b |
| 92 |
16 ccc |
| 93 |
16 xxx |
| 94 |
handler t2 read a<=(15); |
| 95 |
a b |
| 96 |
14 aaa |
| 97 |
handler t2 read a<(15); |
| 98 |
a b |
| 99 |
14 aaa |
| 100 |
handler t2 read a=(54); |
| 101 |
a b |
| 102 |
handler t2 read a>=(54); |
| 103 |
a b |
| 104 |
handler t2 read a>(54); |
| 105 |
a b |
| 106 |
handler t2 read a<=(54); |
| 107 |
a b |
| 108 |
25 xxx |
| 109 |
handler t2 read a<(54); |
| 110 |
a b |
| 111 |
25 xxx |
| 112 |
handler t2 read a=(1); |
| 113 |
a b |
| 114 |
handler t2 read a>=(1); |
| 115 |
a b |
| 116 |
14 aaa |
| 117 |
handler t2 read a>(1); |
| 118 |
a b |
| 119 |
14 aaa |
| 120 |
handler t2 read a<=(1); |
| 121 |
a b |
| 122 |
handler t2 read a<(1); |
| 123 |
a b |
| 124 |
handler t2 read b first limit 5; |
| 125 |
a b |
| 126 |
14 aaa |
| 127 |
16 ccc |
| 128 |
16 xxx |
| 129 |
17 ddd |
| 130 |
18 eee |
| 131 |
handler t2 read b next limit 3; |
| 132 |
a b |
| 133 |
19 fff |
| 134 |
19 yyy |
| 135 |
20 ggg |
| 136 |
handler t2 read b prev limit 10; |
| 137 |
a b |
| 138 |
19 yyy |
| 139 |
19 fff |
| 140 |
18 eee |
| 141 |
17 ddd |
| 142 |
16 xxx |
| 143 |
16 ccc |
| 144 |
14 aaa |
| 145 |
handler t2 read b>=(16) limit 4; |
| 146 |
a b |
| 147 |
16 ccc |
| 148 |
16 xxx |
| 149 |
17 ddd |
| 150 |
18 eee |
| 151 |
handler t2 read b>=(16) limit 2,2; |
| 152 |
a b |
| 153 |
17 ddd |
| 154 |
18 eee |
| 155 |
select * from t1 where a>=16 order by a,b limit 2,2; |
| 156 |
a b |
| 157 |
17 ddd |
| 158 |
18 eee |
| 159 |
handler t2 read a last limit 3; |
| 160 |
a b |
| 161 |
25 xxx |
| 162 |
24 xxx |
| 163 |
23 xxx |
| 164 |
handler t2 read b=(16) limit 1,3; |
| 165 |
a b |
| 166 |
16 xxx |
| 167 |
handler t2 read b=(19); |
| 168 |
a b |
| 169 |
19 fff |
| 170 |
handler t2 read b=(19) where b="yyy"; |
| 171 |
a b |
| 172 |
19 yyy |
| 173 |
handler t2 read first; |
| 174 |
a b |
| 175 |
17 ddd |
| 176 |
handler t2 read next; |
| 177 |
a b |
| 178 |
18 eee |
| 179 |
handler t2 read next; |
| 180 |
a b |
| 181 |
19 fff |
| 182 |
handler t2 close; |
| 183 |
handler t1 open; |
| 184 |
handler t1 read b next; |
| 185 |
a b |
| 186 |
14 aaa |
| 187 |
handler t1 read b next; |
| 188 |
a b |
| 189 |
16 ccc |
| 190 |
handler t1 close; |
| 191 |
handler t1 open; |
| 192 |
handler t1 read a prev; |
| 193 |
a b |
| 194 |
25 xxx |
| 195 |
handler t1 read a prev; |
| 196 |
a b |
| 197 |
24 xxx |
| 198 |
handler t1 close; |
| 199 |
handler t1 open as t2; |
| 200 |
handler t2 read first; |
| 201 |
a b |
| 202 |
17 ddd |
| 203 |
alter table t1 engine = MyISAM; |
| 204 |
handler t2 read first; |
| 205 |
ERROR 42S02: Unknown table 't2' in HANDLER |
| 206 |
handler t1 open; |
| 207 |
handler t1 read a=(20) limit 1,3; |
| 208 |
a b |
| 209 |
flush tables; |
| 210 |
handler t1 read a=(20) limit 1,3; |
| 211 |
a b |
| 212 |
handler t1 close; |
| 213 |
handler t1 open; |
| 214 |
handler t1 read a=(25); |
| 215 |
a b |
| 216 |
25 xxx |
| 217 |
handler t1 read a next; |
| 218 |
a b |
| 219 |
handler t1 read a next; |
| 220 |
a b |
| 221 |
handler t1 read a next; |
| 222 |
a b |
| 223 |
handler t1 read a prev; |
| 224 |
a b |
| 225 |
25 xxx |
| 226 |
handler t1 read a=(1000); |
| 227 |
a b |
| 228 |
handler t1 read a next; |
| 229 |
a b |
| 230 |
handler t1 read a prev; |
| 231 |
a b |
| 232 |
25 xxx |
| 233 |
handler t1 read a=(1000); |
| 234 |
a b |
| 235 |
handler t1 read a prev; |
| 236 |
a b |
| 237 |
25 xxx |
| 238 |
handler t1 read a=(14); |
| 239 |
a b |
| 240 |
14 aaa |
| 241 |
handler t1 read a prev; |
| 242 |
a b |
| 243 |
handler t1 read a prev; |
| 244 |
a b |
| 245 |
handler t1 read a next; |
| 246 |
a b |
| 247 |
14 aaa |
| 248 |
handler t1 read a=(1); |
| 249 |
a b |
| 250 |
handler t1 read a prev; |
| 251 |
a b |
| 252 |
handler t1 read a next; |
| 253 |
a b |
| 254 |
14 aaa |
| 255 |
handler t1 read a=(1); |
| 256 |
a b |
| 257 |
handler t1 read a next; |
| 258 |
a b |
| 259 |
14 aaa |
| 260 |
handler t1 close; |
| 261 |
handler t1 open; |
| 262 |
prepare stmt from 'handler t1 read a=(?) limit ?,?'; |
| 263 |
set @a=20,@b=1,@c=100; |
| 264 |
execute stmt using @a,@b,@c; |
| 265 |
a b |
| 266 |
set @a=20,@b=2,@c=1; |
| 267 |
execute stmt using @a,@b,@c; |
| 268 |
a b |
| 269 |
set @a=20,@b=0,@c=2; |
| 270 |
execute stmt using @a,@b,@c; |
| 271 |
a b |
| 272 |
20 ggg |
| 273 |
deallocate prepare stmt; |
| 274 |
prepare stmt from 'handler t1 read a next limit ?'; |
| 275 |
handler t1 read a>=(21); |
| 276 |
a b |
| 277 |
21 hhh |
| 278 |
set @a=3; |
| 279 |
execute stmt using @a; |
| 280 |
a b |
| 281 |
22 iii |
| 282 |
23 xxx |
| 283 |
24 xxx |
| 284 |
execute stmt using @a; |
| 285 |
a b |
| 286 |
25 xxx |
| 287 |
execute stmt using @a; |
| 288 |
a b |
| 289 |
deallocate prepare stmt; |
| 290 |
prepare stmt from 'handler t1 read b prev limit ?'; |
| 291 |
execute stmt using @a; |
| 292 |
a b |
| 293 |
25 xxx |
| 294 |
24 xxx |
| 295 |
23 xxx |
| 296 |
execute stmt using @a; |
| 297 |
a b |
| 298 |
22 iii |
| 299 |
21 hhh |
| 300 |
20 ggg |
| 301 |
execute stmt using @a; |
| 302 |
a b |
| 303 |
19 yyy |
| 304 |
19 fff |
| 305 |
18 eee |
| 306 |
execute stmt using @a; |
| 307 |
a b |
| 308 |
17 ddd |
| 309 |
16 xxx |
| 310 |
16 ccc |
| 311 |
deallocate prepare stmt; |
| 312 |
prepare stmt from 'handler t1 read b=(?,?)'; |
| 313 |
set @a=14, @b='aaa'; |
| 314 |
execute stmt using @a,@b; |
| 315 |
a b |
| 316 |
14 aaa |
| 317 |
set @a=14, @b='not found'; |
| 318 |
execute stmt using @a,@b; |
| 319 |
a b |
| 320 |
deallocate prepare stmt; |
| 321 |
prepare stmt from 'handler t1 read b=(1+?) limit 10'; |
| 322 |
set @a=15; |
| 323 |
execute stmt using @a; |
| 324 |
a b |
| 325 |
16 ccc |
| 326 |
16 xxx |
| 327 |
execute stmt using @a; |
| 328 |
a b |
| 329 |
16 ccc |
| 330 |
16 xxx |
| 331 |
deallocate prepare stmt; |
| 332 |
prepare stmt from 'handler t1 read b>=(?) where a < ? limit 5'; |
| 333 |
set @a=17, @b=24; |
| 334 |
execute stmt using @a,@b; |
| 335 |
a b |
| 336 |
17 ddd |
| 337 |
18 eee |
| 338 |
19 fff |
| 339 |
19 yyy |
| 340 |
20 ggg |
| 341 |
execute stmt using @a,@b; |
| 342 |
a b |
| 343 |
17 ddd |
| 344 |
18 eee |
| 345 |
19 fff |
| 346 |
19 yyy |
| 347 |
20 ggg |
| 348 |
deallocate prepare stmt; |
| 349 |
prepare stmt from 'handler t1 read a=(?)'; |
| 350 |
set @a=17; |
| 351 |
execute stmt using @a; |
| 352 |
a b |
| 353 |
17 ddd |
| 354 |
alter table t1 add c int; |
| 355 |
execute stmt using @a; |
| 356 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 357 |
deallocate prepare stmt; |
| 358 |
handler t1 close; |
| 359 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 360 |
handler t1 open; |
| 361 |
prepare stmt from 'handler t1 read a=(?)'; |
| 362 |
flush tables; |
| 363 |
set @a=17; |
| 364 |
execute stmt using @a; |
| 365 |
a b c |
| 366 |
17 ddd NULL |
| 367 |
deallocate prepare stmt; |
| 368 |
handler t1 close; |
| 369 |
handler t1 open as t2; |
| 370 |
drop table t1; |
| 371 |
create table t1 (a int not null); |
| 372 |
insert into t1 values (17); |
| 373 |
handler t2 read first; |
| 374 |
ERROR 42S02: Unknown table 't2' in HANDLER |
| 375 |
handler t1 open as t2; |
| 376 |
alter table t1 engine=csv; |
| 377 |
handler t2 read first; |
| 378 |
ERROR 42S02: Unknown table 't2' in HANDLER |
| 379 |
drop table t1; |
| 380 |
create table t1 (a int); |
| 381 |
insert into t1 values (1),(2),(3),(4),(5),(6); |
| 382 |
delete from t1 limit 2; |
| 383 |
handler t1 open; |
| 384 |
handler t1 read first; |
| 385 |
a |
| 386 |
3 |
| 387 |
handler t1 read first limit 1,1; |
| 388 |
a |
| 389 |
4 |
| 390 |
handler t1 read first limit 2,2; |
| 391 |
a |
| 392 |
5 |
| 393 |
6 |
| 394 |
delete from t1 limit 3; |
| 395 |
handler t1 read first; |
| 396 |
a |
| 397 |
6 |
| 398 |
drop table t1; |
| 399 |
create table t1(a int, index using btree (a)); |
| 400 |
insert into t1 values (1), (2), (3); |
| 401 |
handler t1 open; |
| 402 |
handler t1 read a=(W); |
| 403 |
ERROR 42S22: Unknown column 'W' in 'HANDLER ... READ' |
| 404 |
handler t1 read a=(a); |
| 405 |
ERROR HY000: Incorrect arguments to HANDLER ... READ |
| 406 |
drop table t1; |
| 407 |
create table t1 (a char(5)); |
| 408 |
insert into t1 values ("Ok"); |
| 409 |
handler t1 open as t; |
| 410 |
handler t read first; |
| 411 |
a |
| 412 |
Ok |
| 413 |
use mysql; |
| 414 |
handler t read first; |
| 415 |
a |
| 416 |
Ok |
| 417 |
handler t close; |
| 418 |
handler test.t1 open as t; |
| 419 |
handler t read first; |
| 420 |
a |
| 421 |
Ok |
| 422 |
handler t close; |
| 423 |
use test; |
| 424 |
drop table t1; |
| 425 |
create table t1 ( a int, b int, INDEX a using btree (a) ); |
| 426 |
insert into t1 values (1,2), (2,1); |
| 427 |
handler t1 open; |
| 428 |
handler t1 read a=(1) where b=2; |
| 429 |
a b |
| 430 |
1 2 |
| 431 |
handler t1 read a=(1) where b=3; |
| 432 |
a b |
| 433 |
handler t1 read a=(1) where b=1; |
| 434 |
a b |
| 435 |
handler t1 close; |
| 436 |
drop table t1; |
| 437 |
create table t1 (c1 char(20)); |
| 438 |
insert into t1 values ("t1"); |
| 439 |
handler t1 open as h1; |
| 440 |
handler h1 read first limit 9; |
| 441 |
c1 |
| 442 |
t1 |
| 443 |
create table t2 (c1 char(20)); |
| 444 |
insert into t2 values ("t2"); |
| 445 |
handler t2 open as h2; |
| 446 |
handler h2 read first limit 9; |
| 447 |
c1 |
| 448 |
t2 |
| 449 |
create table t3 (c1 char(20)); |
| 450 |
insert into t3 values ("t3"); |
| 451 |
handler t3 open as h3; |
| 452 |
handler h3 read first limit 9; |
| 453 |
c1 |
| 454 |
t3 |
| 455 |
create table t4 (c1 char(20)); |
| 456 |
insert into t4 values ("t4"); |
| 457 |
handler t4 open as h4; |
| 458 |
handler h4 read first limit 9; |
| 459 |
c1 |
| 460 |
t4 |
| 461 |
create table t5 (c1 char(20)); |
| 462 |
insert into t5 values ("t5"); |
| 463 |
handler t5 open as h5; |
| 464 |
handler h5 read first limit 9; |
| 465 |
c1 |
| 466 |
t5 |
| 467 |
alter table t1 engine=MyISAM; |
| 468 |
handler h1 read first limit 9; |
| 469 |
ERROR 42S02: Unknown table 'h1' in HANDLER |
| 470 |
handler h2 read first limit 9; |
| 471 |
c1 |
| 472 |
t2 |
| 473 |
handler h3 read first limit 9; |
| 474 |
c1 |
| 475 |
t3 |
| 476 |
handler h4 read first limit 9; |
| 477 |
c1 |
| 478 |
t4 |
| 479 |
handler h5 read first limit 9; |
| 480 |
c1 |
| 481 |
t5 |
| 482 |
alter table t5 engine=MyISAM; |
| 483 |
handler h1 read first limit 9; |
| 484 |
ERROR 42S02: Unknown table 'h1' in HANDLER |
| 485 |
handler h2 read first limit 9; |
| 486 |
c1 |
| 487 |
t2 |
| 488 |
handler h3 read first limit 9; |
| 489 |
c1 |
| 490 |
t3 |
| 491 |
handler h4 read first limit 9; |
| 492 |
c1 |
| 493 |
t4 |
| 494 |
handler h5 read first limit 9; |
| 495 |
ERROR 42S02: Unknown table 'h5' in HANDLER |
| 496 |
alter table t3 engine=MyISAM; |
| 497 |
handler h1 read first limit 9; |
| 498 |
ERROR 42S02: Unknown table 'h1' in HANDLER |
| 499 |
handler h2 read first limit 9; |
| 500 |
c1 |
| 501 |
t2 |
| 502 |
handler h3 read first limit 9; |
| 503 |
ERROR 42S02: Unknown table 'h3' in HANDLER |
| 504 |
handler h4 read first limit 9; |
| 505 |
c1 |
| 506 |
t4 |
| 507 |
handler h5 read first limit 9; |
| 508 |
ERROR 42S02: Unknown table 'h5' in HANDLER |
| 509 |
handler h2 close; |
| 510 |
handler h4 close; |
| 511 |
handler t1 open as h1_1; |
| 512 |
handler t1 open as h1_2; |
| 513 |
handler t1 open as h1_3; |
| 514 |
handler h1_1 read first limit 9; |
| 515 |
c1 |
| 516 |
t1 |
| 517 |
handler h1_2 read first limit 9; |
| 518 |
c1 |
| 519 |
t1 |
| 520 |
handler h1_3 read first limit 9; |
| 521 |
c1 |
| 522 |
t1 |
| 523 |
alter table t1 engine=MyISAM; |
| 524 |
handler h1_1 read first limit 9; |
| 525 |
ERROR 42S02: Unknown table 'h1_1' in HANDLER |
| 526 |
handler h1_2 read first limit 9; |
| 527 |
ERROR 42S02: Unknown table 'h1_2' in HANDLER |
| 528 |
handler h1_3 read first limit 9; |
| 529 |
ERROR 42S02: Unknown table 'h1_3' in HANDLER |
| 530 |
drop table t1; |
| 531 |
drop table t2; |
| 532 |
drop table t3; |
| 533 |
drop table t4; |
| 534 |
drop table t5; |
| 535 |
create table t1 (c1 int); |
| 536 |
insert into t1 values (1); |
| 537 |
handler t1 open; |
| 538 |
handler t1 read first; |
| 539 |
c1 |
| 540 |
1 |
| 541 |
connect con2,localhost,root,,; |
| 542 |
connection con2; |
| 543 |
send the below to another connection, do not wait for the result |
| 544 |
optimize table t1; |
| 545 |
connection default; |
| 546 |
handler t1 read next; |
| 547 |
c1 |
| 548 |
handler t1 close; |
| 549 |
connection con2; |
| 550 |
Table Op Msg_type Msg_text |
| 551 |
test.t1 optimize status OK |
| 552 |
connection default; |
| 553 |
drop table t1; |
| 554 |
CREATE TABLE t1 ( no1 smallint(5) NOT NULL default '0', no2 int(10) NOT NULL default '0', PRIMARY KEY using btree (no1,no2)); |
| 555 |
INSERT INTO t1 VALUES (1,274),(1,275),(2,6),(2,8),(4,1),(4,2); |
| 556 |
HANDLER t1 OPEN; |
| 557 |
HANDLER t1 READ `primary` = (1, 1000); |
| 558 |
no1 no2 |
| 559 |
HANDLER t1 READ `primary` PREV; |
| 560 |
no1 no2 |
| 561 |
1 275 |
| 562 |
HANDLER t1 READ `primary` = (1, 1000); |
| 563 |
no1 no2 |
| 564 |
HANDLER t1 READ `primary` NEXT; |
| 565 |
no1 no2 |
| 566 |
2 6 |
| 567 |
DROP TABLE t1; |
| 568 |
create table t1 (c1 int); |
| 569 |
insert into t1 values (14397); |
| 570 |
flush tables with read lock; |
| 571 |
drop table t1; |
| 572 |
ERROR HY000: Can't execute the query because you have a conflicting read lock |
| 573 |
connection con2; |
| 574 |
drop table t1; |
| 575 |
connection default; |
| 576 |
select * from t1; |
| 577 |
c1 |
| 578 |
14397 |
| 579 |
unlock tables; |
| 580 |
connection con2; |
| 581 |
read the result from the other connection |
| 582 |
connection default; |
| 583 |
select * from t1; |
| 584 |
ERROR 42S02: Table 'test.t1' doesn't exist |
| 585 |
drop table if exists t1; |
| 586 |
Warnings: |
| 587 |
Note 1051 Unknown table 'test.t1' |
| 588 |
create table t1 (a int not null) ENGINE=csv; |
| 589 |
connection con2; |
| 590 |
handler t1 open; |
| 591 |
ERROR HY000: Storage engine CSV of the table `test`.`t1` doesn't have this option |
| 592 |
connection default; |
| 593 |
drop table t1; |
| 594 |
disconnect con2; |
| 595 |
create table t1 (a int); |
| 596 |
handler t1 open as t1_alias; |
| 597 |
handler t1_alias read a next; |
| 598 |
ERROR 42000: Key 'a' doesn't exist in table 't1_alias' |
| 599 |
handler t1_alias READ a next where inexistent > 0; |
| 600 |
ERROR 42S22: Unknown column 'inexistent' in 'WHERE' |
| 601 |
handler t1_alias read a next; |
| 602 |
ERROR 42000: Key 'a' doesn't exist in table 't1_alias' |
| 603 |
handler t1_alias READ a next where inexistent > 0; |
| 604 |
ERROR 42S22: Unknown column 'inexistent' in 'WHERE' |
| 605 |
handler t1_alias close; |
| 606 |
drop table t1; |
| 607 |
create temporary table t1 (a int, b char(1), key a using btree (a), key b using btree (a,b)); |
| 608 |
insert into t1 values (0,"a"),(1,"b"),(2,"c"),(3,"d"),(4,"e"), |
| 609 |
(5,"f"),(6,"g"),(7,"h"),(8,"i"),(9,"j"),(9,'k'); |
| 610 |
select a,b from t1; |
| 611 |
a b |
| 612 |
0 a |
| 613 |
1 b |
| 614 |
2 c |
| 615 |
3 d |
| 616 |
4 e |
| 617 |
5 f |
| 618 |
6 g |
| 619 |
7 h |
| 620 |
8 i |
| 621 |
9 j |
| 622 |
9 k |
| 623 |
handler t1 open as a1; |
| 624 |
handler a1 read a=(1); |
| 625 |
a b |
| 626 |
1 b |
| 627 |
handler a1 read a next; |
| 628 |
a b |
| 629 |
2 c |
| 630 |
handler a1 read a next; |
| 631 |
a b |
| 632 |
3 d |
| 633 |
select a,b from t1; |
| 634 |
a b |
| 635 |
0 a |
| 636 |
1 b |
| 637 |
2 c |
| 638 |
3 d |
| 639 |
4 e |
| 640 |
5 f |
| 641 |
6 g |
| 642 |
7 h |
| 643 |
8 i |
| 644 |
9 j |
| 645 |
9 k |
| 646 |
handler a1 read a prev; |
| 647 |
a b |
| 648 |
2 c |
| 649 |
handler a1 read a prev; |
| 650 |
a b |
| 651 |
1 b |
| 652 |
handler a1 read a=(6) where b="g"; |
| 653 |
a b |
| 654 |
6 g |
| 655 |
handler a1 close; |
| 656 |
select a,b from t1; |
| 657 |
a b |
| 658 |
0 a |
| 659 |
1 b |
| 660 |
2 c |
| 661 |
3 d |
| 662 |
4 e |
| 663 |
5 f |
| 664 |
6 g |
| 665 |
7 h |
| 666 |
8 i |
| 667 |
9 j |
| 668 |
9 k |
| 669 |
handler t1 open as a2; |
| 670 |
handler a2 read b=(9); |
| 671 |
a b |
| 672 |
9 j |
| 673 |
handler a2 read b next; |
| 674 |
a b |
| 675 |
9 k |
| 676 |
handler a2 read b prev limit 2; |
| 677 |
a b |
| 678 |
9 j |
| 679 |
8 i |
| 680 |
handler a2 read b last; |
| 681 |
a b |
| 682 |
9 k |
| 683 |
handler a2 read b prev; |
| 684 |
a b |
| 685 |
9 j |
| 686 |
handler a2 close; |
| 687 |
drop table t1; |
| 688 |
create table t1 (a int); |
| 689 |
create temporary table t2 (a int, key using btree (a)); |
| 690 |
handler t1 open as a1; |
| 691 |
handler t2 open as a2; |
| 692 |
handler a2 read a first; |
| 693 |
a |
| 694 |
drop table t1, t2; |
| 695 |
handler a2 read a next; |
| 696 |
ERROR 42S02: Unknown table 'a2' in HANDLER |
| 697 |
handler a1 close; |
| 698 |
ERROR 42S02: Unknown table 'a1' in HANDLER |
| 699 |
create table t1 (a int, key using btree (a)); |
| 700 |
create table t2 like t1; |
| 701 |
handler t1 open as a1; |
| 702 |
handler t2 open as a2; |
| 703 |
handler a1 read a first; |
| 704 |
a |
| 705 |
handler a2 read a first; |
| 706 |
a |
| 707 |
alter table t1 add b int; |
| 708 |
handler a1 close; |
| 709 |
ERROR 42S02: Unknown table 'a1' in HANDLER |
| 710 |
handler a2 close; |
| 711 |
drop table t1, t2; |
| 712 |
create table t1 (a int, key using btree (a)); |
| 713 |
handler t1 open as a1; |
| 714 |
handler a1 read a first; |
| 715 |
a |
| 716 |
rename table t1 to t2; |
| 717 |
handler a1 read a first; |
| 718 |
ERROR 42S02: Unknown table 'a1' in HANDLER |
| 719 |
drop table t2; |
| 720 |
create table t1 (a int, key using btree (a)); |
| 721 |
create table t2 like t1; |
| 722 |
handler t1 open as a1; |
| 723 |
handler t2 open as a2; |
| 724 |
handler a1 read a first; |
| 725 |
a |
| 726 |
handler a2 read a first; |
| 727 |
a |
| 728 |
optimize table t1; |
| 729 |
Table Op Msg_type Msg_text |
| 730 |
test.t1 optimize status Table is already up to date |
| 731 |
handler a1 close; |
| 732 |
ERROR 42S02: Unknown table 'a1' in HANDLER |
| 733 |
handler a2 close; |
| 734 |
drop table t1, t2; |
| 735 |
# |
| 736 |
# Add test coverage for HANDLER and LOCK TABLES, HANDLER and DDL. |
| 737 |
# |
| 738 |
drop table if exists t1, t2, t3; |
| 739 |
create table t1 (a int, key a (a)); |
| 740 |
insert into t1 (a) values (1), (2), (3), (4), (5); |
| 741 |
create table t2 (a int, key a (a)) select * from t1; |
| 742 |
create temporary table t3 (a int, key a (a)) select * from t2; |
| 743 |
handler t1 open; |
| 744 |
handler t2 open; |
| 745 |
handler t3 open; |
| 746 |
# |
| 747 |
# No HANDLER sql is allowed under LOCK TABLES. |
| 748 |
# But it does not implicitly closes all handlers. |
| 749 |
# |
| 750 |
lock table t1 read; |
| 751 |
handler t1 open; |
| 752 |
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction |
| 753 |
handler t1 read next; |
| 754 |
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction |
| 755 |
handler t2 close; |
| 756 |
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction |
| 757 |
handler t3 open; |
| 758 |
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction |
| 759 |
# After UNLOCK TABLES handlers should be around and |
| 760 |
# we should be able to continue reading through them. |
| 761 |
unlock tables; |
| 762 |
handler t1 read next; |
| 763 |
a |
| 764 |
1 |
| 765 |
handler t1 close; |
| 766 |
handler t2 read next; |
| 767 |
a |
| 768 |
1 |
| 769 |
handler t2 close; |
| 770 |
handler t3 read next; |
| 771 |
a |
| 772 |
1 |
| 773 |
handler t3 close; |
| 774 |
drop temporary table t3; |
| 775 |
# |
| 776 |
# Other operations that implicitly close handler: |
| 777 |
# |
| 778 |
# TRUNCATE |
| 779 |
# |
| 780 |
handler t1 open; |
| 781 |
truncate table t1; |
| 782 |
handler t1 read next; |
| 783 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 784 |
handler t1 open; |
| 785 |
# |
| 786 |
# CREATE TRIGGER |
| 787 |
# |
| 788 |
create trigger t1_ai after insert on t1 for each row set @a=1; |
| 789 |
handler t1 read next; |
| 790 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 791 |
# |
| 792 |
# DROP TRIGGER |
| 793 |
# |
| 794 |
handler t1 open; |
| 795 |
drop trigger t1_ai; |
| 796 |
handler t1 read next; |
| 797 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 798 |
# |
| 799 |
# ALTER TABLE |
| 800 |
# |
| 801 |
handler t1 open; |
| 802 |
alter table t1 add column b int; |
| 803 |
handler t1 read next; |
| 804 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 805 |
# |
| 806 |
# ANALYZE TABLE |
| 807 |
# |
| 808 |
handler t1 open; |
| 809 |
analyze table t1; |
| 810 |
Table Op Msg_type Msg_text |
| 811 |
test.t1 analyze status Engine-independent statistics collected |
| 812 |
test.t1 analyze status Table is already up to date |
| 813 |
handler t1 read next; |
| 814 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 815 |
# |
| 816 |
# OPTIMIZE TABLE |
| 817 |
# |
| 818 |
handler t1 open; |
| 819 |
optimize table t1; |
| 820 |
Table Op Msg_type Msg_text |
| 821 |
test.t1 optimize status OK |
| 822 |
handler t1 read next; |
| 823 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 824 |
# |
| 825 |
# REPAIR TABLE |
| 826 |
# |
| 827 |
handler t1 open; |
| 828 |
repair table t1; |
| 829 |
Table Op Msg_type Msg_text |
| 830 |
test.t1 repair status OK |
| 831 |
handler t1 read next; |
| 832 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 833 |
# |
| 834 |
# DROP TABLE, naturally. |
| 835 |
# |
| 836 |
handler t1 open; |
| 837 |
drop table t1; |
| 838 |
handler t1 read next; |
| 839 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 840 |
create table t1 (a int, b int, key a using btree (a)) select a from t2; |
| 841 |
# |
| 842 |
# RENAME TABLE, naturally |
| 843 |
# |
| 844 |
handler t1 open; |
| 845 |
rename table t1 to t3; |
| 846 |
handler t1 read next; |
| 847 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 848 |
# |
| 849 |
# CREATE TABLE (even with IF NOT EXISTS clause, |
| 850 |
# and the table exists). |
| 851 |
# |
| 852 |
handler t2 open; |
| 853 |
create table if not exists t2 (a int); |
| 854 |
Warnings: |
| 855 |
Note 1050 Table 't2' already exists |
| 856 |
handler t2 read next; |
| 857 |
ERROR 42S02: Unknown table 't2' in HANDLER |
| 858 |
rename table t3 to t1; |
| 859 |
drop table t2; |
| 860 |
# |
| 861 |
# FLUSH TABLE doesn't close the table but loses the position |
| 862 |
# |
| 863 |
handler t1 open; |
| 864 |
handler t1 read a prev; |
| 865 |
b a |
| 866 |
NULL 5 |
| 867 |
flush table t1; |
| 868 |
handler t1 read a prev; |
| 869 |
b a |
| 870 |
NULL 5 |
| 871 |
handler t1 close; |
| 872 |
# |
| 873 |
# FLUSH TABLES WITH READ LOCK behaves like FLUSH TABLE. |
| 874 |
# |
| 875 |
handler t1 open; |
| 876 |
handler t1 read a prev; |
| 877 |
b a |
| 878 |
NULL 5 |
| 879 |
flush tables with read lock; |
| 880 |
handler t1 read a prev; |
| 881 |
b a |
| 882 |
NULL 5 |
| 883 |
handler t1 close; |
| 884 |
unlock tables; |
| 885 |
# |
| 886 |
# Let us also check that these operations behave in similar |
| 887 |
# way under LOCK TABLES. |
| 888 |
# |
| 889 |
# TRUNCATE under LOCK TABLES. |
| 890 |
# |
| 891 |
handler t1 open; |
| 892 |
lock tables t1 write; |
| 893 |
truncate table t1; |
| 894 |
unlock tables; |
| 895 |
handler t1 read next; |
| 896 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 897 |
handler t1 open; |
| 898 |
# |
| 899 |
# CREATE TRIGGER under LOCK TABLES. |
| 900 |
# |
| 901 |
lock tables t1 write; |
| 902 |
create trigger t1_ai after insert on t1 for each row set @a=1; |
| 903 |
unlock tables; |
| 904 |
handler t1 read next; |
| 905 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 906 |
# |
| 907 |
# DROP TRIGGER under LOCK TABLES. |
| 908 |
# |
| 909 |
handler t1 open; |
| 910 |
lock tables t1 write; |
| 911 |
drop trigger t1_ai; |
| 912 |
unlock tables; |
| 913 |
handler t1 read next; |
| 914 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 915 |
# |
| 916 |
# ALTER TABLE under LOCK TABLES. |
| 917 |
# |
| 918 |
handler t1 open; |
| 919 |
lock tables t1 write; |
| 920 |
alter table t1 drop column b; |
| 921 |
unlock tables; |
| 922 |
handler t1 read next; |
| 923 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 924 |
# |
| 925 |
# ANALYZE TABLE under LOCK TABLES. |
| 926 |
# |
| 927 |
handler t1 open; |
| 928 |
lock tables t1 write; |
| 929 |
analyze table t1; |
| 930 |
Table Op Msg_type Msg_text |
| 931 |
test.t1 analyze status Engine-independent statistics collected |
| 932 |
test.t1 analyze status Table is already up to date |
| 933 |
unlock tables; |
| 934 |
handler t1 read next; |
| 935 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 936 |
# |
| 937 |
# OPTIMIZE TABLE under LOCK TABLES. |
| 938 |
# |
| 939 |
handler t1 open; |
| 940 |
lock tables t1 write; |
| 941 |
optimize table t1; |
| 942 |
Table Op Msg_type Msg_text |
| 943 |
test.t1 optimize status OK |
| 944 |
unlock tables; |
| 945 |
handler t1 read next; |
| 946 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 947 |
# |
| 948 |
# REPAIR TABLE under LOCK TABLES. |
| 949 |
# |
| 950 |
handler t1 open; |
| 951 |
lock tables t1 write; |
| 952 |
repair table t1; |
| 953 |
Table Op Msg_type Msg_text |
| 954 |
test.t1 repair status OK |
| 955 |
unlock tables; |
| 956 |
handler t1 read next; |
| 957 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 958 |
# |
| 959 |
# DROP TABLE under LOCK TABLES, naturally. |
| 960 |
# |
| 961 |
handler t1 open; |
| 962 |
lock tables t1 write; |
| 963 |
drop table t1; |
| 964 |
unlock tables; |
| 965 |
handler t1 read next; |
| 966 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 967 |
create table t1 (a int, b int, key a using btree (a)); |
| 968 |
insert into t1 (a) values (1), (2), (3), (4), (5); |
| 969 |
# |
| 970 |
# FLUSH TABLE doesn't close the table but loses the position |
| 971 |
# |
| 972 |
handler t1 open; |
| 973 |
handler t1 read a prev; |
| 974 |
a b |
| 975 |
5 NULL |
| 976 |
lock tables t1 write; |
| 977 |
flush table t1; |
| 978 |
unlock tables; |
| 979 |
handler t1 read a prev; |
| 980 |
a b |
| 981 |
5 NULL |
| 982 |
handler t1 close; |
| 983 |
# |
| 984 |
# Explore the effect of HANDLER locks on concurrent DDL |
| 985 |
# |
| 986 |
handler t1 open; |
| 987 |
connect con1, localhost, root,,; |
| 988 |
connect con2, localhost, root,,; |
| 989 |
connect con3, localhost, root,,; |
| 990 |
connection con1; |
| 991 |
# Sending: |
| 992 |
drop table t1 ; |
| 993 |
# We can't use connection 'default' as wait_condition will |
| 994 |
# autoclose handlers. |
| 995 |
connection con2; |
| 996 |
# Waitng for 'drop table t1' to get blocked... |
| 997 |
connection default; |
| 998 |
handler t1 read a prev; |
| 999 |
a b |
| 1000 |
5 NULL |
| 1001 |
handler t1 read a prev; |
| 1002 |
a b |
| 1003 |
4 NULL |
| 1004 |
handler t1 close; |
| 1005 |
connection con1; |
| 1006 |
# Reaping 'drop table t1'... |
| 1007 |
connection default; |
| 1008 |
# |
| 1009 |
# Explore the effect of HANDLER locks in parallel with SELECT |
| 1010 |
# |
| 1011 |
create table t1 (a int, key a using btree (a)); |
| 1012 |
insert into t1 (a) values (1), (2), (3), (4), (5); |
| 1013 |
begin; |
| 1014 |
select * from t1; |
| 1015 |
a |
| 1016 |
1 |
| 1017 |
2 |
| 1018 |
3 |
| 1019 |
4 |
| 1020 |
5 |
| 1021 |
handler t1 open; |
| 1022 |
handler t1 read a prev; |
| 1023 |
a |
| 1024 |
5 |
| 1025 |
handler t1 read a prev; |
| 1026 |
a |
| 1027 |
4 |
| 1028 |
handler t1 close; |
| 1029 |
connection con1; |
| 1030 |
# Sending: |
| 1031 |
drop table t1 ; |
| 1032 |
connection con2; |
| 1033 |
# Waiting for 'drop table t1' to get blocked... |
| 1034 |
connection default; |
| 1035 |
# We can still use the table, it's part of the transaction |
| 1036 |
select * from t1; |
| 1037 |
a |
| 1038 |
1 |
| 1039 |
2 |
| 1040 |
3 |
| 1041 |
4 |
| 1042 |
5 |
| 1043 |
# Such are the circumstances that t1 is a part of transaction, |
| 1044 |
# thus we can reopen it in the handler |
| 1045 |
handler t1 open; |
| 1046 |
# We can commit the transaction, it doesn't close the handler |
| 1047 |
# and doesn't let DROP to proceed. |
| 1048 |
commit; |
| 1049 |
handler t1 read a prev; |
| 1050 |
a |
| 1051 |
5 |
| 1052 |
handler t1 read a prev; |
| 1053 |
a |
| 1054 |
4 |
| 1055 |
handler t1 read a prev; |
| 1056 |
a |
| 1057 |
3 |
| 1058 |
handler t1 close; |
| 1059 |
connection con1; |
| 1060 |
# Now drop can proceed |
| 1061 |
# Reaping 'drop table t1'... |
| 1062 |
connection default; |
| 1063 |
# |
| 1064 |
# Demonstrate that HANDLER locks and transaction locks |
| 1065 |
# reside in the same context. |
| 1066 |
# |
| 1067 |
create table t1 (a int, key a (a)); |
| 1068 |
insert into t1 (a) values (1), (2), (3), (4), (5); |
| 1069 |
create table t0 (a int, key a using btree (a)); |
| 1070 |
insert into t0 (a) values (1), (2), (3), (4), (5); |
| 1071 |
begin; |
| 1072 |
select * from t1; |
| 1073 |
a |
| 1074 |
1 |
| 1075 |
2 |
| 1076 |
3 |
| 1077 |
4 |
| 1078 |
5 |
| 1079 |
connection con2; |
| 1080 |
# Sending: |
| 1081 |
rename table t0 to t3, t1 to t0, t3 to t1; |
| 1082 |
connection con1; |
| 1083 |
# Waiting for 'rename table ...' to get blocked... |
| 1084 |
connection default; |
| 1085 |
# We back-off on hitting deadlock condition. |
| 1086 |
handler t0 open; |
| 1087 |
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction |
| 1088 |
select * from t0; |
| 1089 |
a |
| 1090 |
1 |
| 1091 |
2 |
| 1092 |
3 |
| 1093 |
4 |
| 1094 |
5 |
| 1095 |
handler t1 open; |
| 1096 |
commit; |
| 1097 |
handler t1 close; |
| 1098 |
connection con2; |
| 1099 |
# Reaping 'rename table ...'... |
| 1100 |
connection default; |
| 1101 |
handler t1 open; |
| 1102 |
handler t1 read a prev; |
| 1103 |
a |
| 1104 |
5 |
| 1105 |
handler t1 close; |
| 1106 |
drop table t0; |
| 1107 |
# |
| 1108 |
# Originally there was a deadlock error in this test. |
| 1109 |
# With implementation of deadlock detector |
| 1110 |
# we no longer deadlock, but block and wait on a lock. |
| 1111 |
# The HANDLER is auto-closed as soon as the connection |
| 1112 |
# sees a pending conflicting lock against it. |
| 1113 |
# |
| 1114 |
create table t2 (a int, key a (a)); |
| 1115 |
handler t1 open; |
| 1116 |
connection con1; |
| 1117 |
lock tables t2 read; |
| 1118 |
connection con2; |
| 1119 |
# Sending 'drop table t2'... |
| 1120 |
drop table t2; |
| 1121 |
connection con1; |
| 1122 |
# Waiting for 'drop table t2' to get blocked... |
| 1123 |
connection default; |
| 1124 |
# Sending 'select * from t2' |
| 1125 |
select * from t2; |
| 1126 |
connection con1; |
| 1127 |
# Waiting for 'select * from t2' to get blocked... |
| 1128 |
unlock tables; |
| 1129 |
connection con2; |
| 1130 |
# Reaping 'drop table t2'... |
| 1131 |
connection default; |
| 1132 |
# Reaping 'select * from t2' |
| 1133 |
ERROR 42S02: Table 'test.t2' doesn't exist |
| 1134 |
handler t1 close; |
| 1135 |
drop table t1; |
| 1136 |
# |
| 1137 |
# If we have to wait on an exclusive locks while having |
| 1138 |
# an open HANDLER, ER_LOCK_DEADLOCK is reported. |
| 1139 |
# |
| 1140 |
create table t1 (a int, key a(a)); |
| 1141 |
handler t1 open; |
| 1142 |
connection con1; |
| 1143 |
select get_lock('lock1', 10); |
| 1144 |
get_lock('lock1', 10) |
| 1145 |
1 |
| 1146 |
connection default; |
| 1147 |
select get_lock('lock1', 10); |
| 1148 |
connection con2; |
| 1149 |
# Waiting for 'select get_lock('lock1', 10)' to get blocked... |
| 1150 |
connection con1; |
| 1151 |
drop table t1; |
| 1152 |
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction |
| 1153 |
select release_lock('lock1'); |
| 1154 |
release_lock('lock1') |
| 1155 |
1 |
| 1156 |
connection default; |
| 1157 |
get_lock('lock1', 10) |
| 1158 |
1 |
| 1159 |
select release_lock('lock1'); |
| 1160 |
release_lock('lock1') |
| 1161 |
1 |
| 1162 |
# Demonstrate that there is no deadlock with FLUSH TABLE, |
| 1163 |
# even though it is waiting for the other table to go away |
| 1164 |
create table t2 like t1; |
| 1165 |
# Sending: |
| 1166 |
flush table t2; |
| 1167 |
connection con2; |
| 1168 |
drop table t1; |
| 1169 |
connection con1; |
| 1170 |
unlock tables; |
| 1171 |
connection default; |
| 1172 |
# Reaping 'flush table t2'... |
| 1173 |
drop table t2; |
| 1174 |
# |
| 1175 |
# Bug #46224 HANDLER statements within a transaction might |
| 1176 |
# lead to deadlocks |
| 1177 |
# |
| 1178 |
create table t1 (a int, key using btree (a)); |
| 1179 |
insert into t1 values (1), (2); |
| 1180 |
connection default; |
| 1181 |
begin; |
| 1182 |
select * from t1; |
| 1183 |
a |
| 1184 |
1 |
| 1185 |
2 |
| 1186 |
handler t1 open; |
| 1187 |
connection con1; |
| 1188 |
# Sending: |
| 1189 |
lock tables t1 write; |
| 1190 |
connection con2; |
| 1191 |
# Check that 'lock tables t1 write' waits until transaction which |
| 1192 |
# has read from the table commits. |
| 1193 |
connection default; |
| 1194 |
# The below 'handler t1 read ...' should not be blocked as |
| 1195 |
# 'lock tables t1 write' has not succeeded yet. |
| 1196 |
handler t1 read a next; |
| 1197 |
a |
| 1198 |
1 |
| 1199 |
# Unblock 'lock tables t1 write'. |
| 1200 |
select * from t1; |
| 1201 |
a |
| 1202 |
1 |
| 1203 |
2 |
| 1204 |
commit; |
| 1205 |
connection con1; |
| 1206 |
# Reap 'lock tables t1 write'. |
| 1207 |
connection default; |
| 1208 |
# Sending: |
| 1209 |
handler t1 read a next; |
| 1210 |
connection con1; |
| 1211 |
# Waiting for 'handler t1 read a next' to get blocked... |
| 1212 |
# The below 'drop table t1' should be able to proceed without |
| 1213 |
# waiting as it will force HANDLER to be closed. |
| 1214 |
drop table t1; |
| 1215 |
unlock tables; |
| 1216 |
connection default; |
| 1217 |
# Reaping 'handler t1 read a next'... |
| 1218 |
ERROR 42S02: Table 'test.t1' doesn't exist |
| 1219 |
handler t1 close; |
| 1220 |
connection con1; |
| 1221 |
disconnect con1; |
| 1222 |
connection con2; |
| 1223 |
disconnect con2; |
| 1224 |
connection con3; |
| 1225 |
disconnect con3; |
| 1226 |
connection default; |
| 1227 |
# |
| 1228 |
# A temporary table test. |
| 1229 |
# Check that we don't loose positions of HANDLER opened |
| 1230 |
# against a temporary table. |
| 1231 |
# |
| 1232 |
create table t1 (a int, b int, key using btree (a)); |
| 1233 |
insert into t1 (a) values (1), (2), (3), (4), (5); |
| 1234 |
create temporary table t2 (a int, b int, key using btree (a)); |
| 1235 |
insert into t2 (a) select a from t1; |
| 1236 |
handler t1 open; |
| 1237 |
handler t1 read a next; |
| 1238 |
a b |
| 1239 |
1 NULL |
| 1240 |
handler t2 open; |
| 1241 |
handler t2 read a next; |
| 1242 |
a b |
| 1243 |
1 NULL |
| 1244 |
flush table t1; |
| 1245 |
handler t2 read a next; |
| 1246 |
a b |
| 1247 |
2 NULL |
| 1248 |
# Sic: the position is lost |
| 1249 |
handler t1 read a next; |
| 1250 |
a b |
| 1251 |
1 NULL |
| 1252 |
select * from t1; |
| 1253 |
a b |
| 1254 |
1 NULL |
| 1255 |
2 NULL |
| 1256 |
3 NULL |
| 1257 |
4 NULL |
| 1258 |
5 NULL |
| 1259 |
# Sic: the position is not lost |
| 1260 |
handler t2 read a next; |
| 1261 |
a b |
| 1262 |
3 NULL |
| 1263 |
select * from t2; |
| 1264 |
a b |
| 1265 |
1 NULL |
| 1266 |
2 NULL |
| 1267 |
3 NULL |
| 1268 |
4 NULL |
| 1269 |
5 NULL |
| 1270 |
handler t2 read a next; |
| 1271 |
a b |
| 1272 |
4 NULL |
| 1273 |
drop table t1; |
| 1274 |
drop temporary table t2; |
| 1275 |
# |
| 1276 |
# A test for lock_table_names()/unlock_table_names() function. |
| 1277 |
# It should work properly in presence of open HANDLER. |
| 1278 |
# |
| 1279 |
create table t1 (a int, b int, key a (a)); |
| 1280 |
create table t2 like t1; |
| 1281 |
create table t3 like t1; |
| 1282 |
create table t4 like t1; |
| 1283 |
handler t1 open; |
| 1284 |
handler t2 open; |
| 1285 |
rename table t4 to t5, t3 to t4, t5 to t3; |
| 1286 |
handler t1 read first; |
| 1287 |
a b |
| 1288 |
handler t2 read first; |
| 1289 |
a b |
| 1290 |
drop table t1, t2, t3, t4; |
| 1291 |
# |
| 1292 |
# A test for FLUSH TABLES WITH READ LOCK and HANDLER statements. |
| 1293 |
# |
| 1294 |
set autocommit=0; |
| 1295 |
create table t1 (a int, b int, key a (a)); |
| 1296 |
insert into t1 (a, b) values (1, 1), (2, 1), (3, 2), (4, 2), (5, 5); |
| 1297 |
create table t2 like t1; |
| 1298 |
insert into t2 (a, b) select a, b from t1; |
| 1299 |
create table t3 like t1; |
| 1300 |
insert into t3 (a, b) select a, b from t1; |
| 1301 |
commit; |
| 1302 |
flush tables with read lock; |
| 1303 |
handler t1 open; |
| 1304 |
lock table t1 read; |
| 1305 |
handler t1 read next; |
| 1306 |
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction |
| 1307 |
# This implicitly leaves LOCK TABLES but doesn't drop the GLR |
| 1308 |
lock table not_exists_write read; |
| 1309 |
ERROR 42S02: Table 'test.not_exists_write' doesn't exist |
| 1310 |
# We still have the read lock. |
| 1311 |
drop table t1; |
| 1312 |
ERROR HY000: Can't execute the query because you have a conflicting read lock |
| 1313 |
handler t1 open; |
| 1314 |
select a from t2; |
| 1315 |
a |
| 1316 |
1 |
| 1317 |
2 |
| 1318 |
3 |
| 1319 |
4 |
| 1320 |
5 |
| 1321 |
handler t1 read next; |
| 1322 |
a b |
| 1323 |
1 1 |
| 1324 |
flush tables with read lock; |
| 1325 |
handler t2 open; |
| 1326 |
flush tables with read lock; |
| 1327 |
handler t1 read next; |
| 1328 |
a b |
| 1329 |
2 1 |
| 1330 |
select a from t3; |
| 1331 |
a |
| 1332 |
1 |
| 1333 |
2 |
| 1334 |
3 |
| 1335 |
4 |
| 1336 |
5 |
| 1337 |
handler t2 read next; |
| 1338 |
a b |
| 1339 |
1 1 |
| 1340 |
handler t1 close; |
| 1341 |
rollback; |
| 1342 |
handler t2 close; |
| 1343 |
drop table t1; |
| 1344 |
ERROR HY000: Can't execute the query because you have a conflicting read lock |
| 1345 |
commit; |
| 1346 |
flush tables; |
| 1347 |
drop table t1; |
| 1348 |
ERROR HY000: Can't execute the query because you have a conflicting read lock |
| 1349 |
unlock tables; |
| 1350 |
drop table t1; |
| 1351 |
set autocommit=default; |
| 1352 |
drop table t2, t3; |
| 1353 |
# |
| 1354 |
# HANDLER statement and operation-type aware metadata locks. |
| 1355 |
# Check that when we clone a ticket for HANDLER we downrade |
| 1356 |
# the lock. |
| 1357 |
# |
| 1358 |
connect con1,localhost,root,,; |
| 1359 |
connection default; |
| 1360 |
create table t1 (a int, b int, key using btree (a)); |
| 1361 |
insert into t1 (a, b) values (1, 1), (2, 1), (3, 2), (4, 2), (5, 5); |
| 1362 |
begin; |
| 1363 |
insert into t1 (a, b) values (6, 6); |
| 1364 |
handler t1 open; |
| 1365 |
handler t1 read a last; |
| 1366 |
a b |
| 1367 |
6 6 |
| 1368 |
insert into t1 (a, b) values (7, 7); |
| 1369 |
handler t1 read a last; |
| 1370 |
a b |
| 1371 |
7 7 |
| 1372 |
commit; |
| 1373 |
connection default; |
| 1374 |
handler t1 read a prev; |
| 1375 |
a b |
| 1376 |
6 6 |
| 1377 |
handler t1 close; |
| 1378 |
# Cleanup. |
| 1379 |
drop table t1; |
| 1380 |
connection con1; |
| 1381 |
disconnect con1; |
| 1382 |
connection default; |
| 1383 |
# |
| 1384 |
# A test for Bug#50555 "handler commands crash server in |
| 1385 |
# my_hash_first()". |
| 1386 |
# |
| 1387 |
handler no_such_table read no_such_index first; |
| 1388 |
ERROR 42S02: Unknown table 'no_such_table' in HANDLER |
| 1389 |
handler no_such_table close; |
| 1390 |
ERROR 42S02: Unknown table 'no_such_table' in HANDLER |
| 1391 |
# |
| 1392 |
# Bug#50907 Assertion `hash_tables->table->next == __null' on |
| 1393 |
# HANDLER OPEN |
| 1394 |
# |
| 1395 |
DROP TABLE IF EXISTS t1, t2; |
| 1396 |
CREATE TEMPORARY TABLE t1 (i INT); |
| 1397 |
CREATE TEMPORARY TABLE t2 (i INT); |
| 1398 |
HANDLER t2 OPEN; |
| 1399 |
HANDLER t2 READ FIRST; |
| 1400 |
i |
| 1401 |
HANDLER t2 CLOSE; |
| 1402 |
DROP TABLE t1, t2; |
| 1403 |
# |
| 1404 |
# Bug#50912 Assertion `ticket->m_type >= mdl_request->type' |
| 1405 |
# failed on HANDLER + I_S |
| 1406 |
# |
| 1407 |
DROP TABLE IF EXISTS t1; |
| 1408 |
CREATE TABLE t1 (id INT); |
| 1409 |
HANDLER t1 OPEN; |
| 1410 |
SELECT table_name, table_comment FROM information_schema.tables |
| 1411 |
WHERE table_schema= 'test' AND table_name= 't1'; |
| 1412 |
table_name table_comment |
| 1413 |
t1 |
| 1414 |
HANDLER t1 CLOSE; |
| 1415 |
DROP TABLE t1; |
| 1416 |
# |
| 1417 |
# Test for bug #50908 "Assertion `handler_tables_hash.records == 0' |
| 1418 |
# failed in enter_locked_tables_mode". |
| 1419 |
# |
| 1420 |
drop tables if exists t1, t2; |
| 1421 |
drop function if exists f1; |
| 1422 |
create table t1 (i int); |
| 1423 |
insert into t1 values (1), (2); |
| 1424 |
create table t2 (j int); |
| 1425 |
insert into t2 values (1); |
| 1426 |
create function f1() returns int return (select count(*) from t2); |
| 1427 |
# Check that open HANDLER survives statement executed in |
| 1428 |
# prelocked mode. |
| 1429 |
handler t1 open; |
| 1430 |
handler t1 read next; |
| 1431 |
i |
| 1432 |
1 |
| 1433 |
# The below statement were aborted due to an assertion failure. |
| 1434 |
select f1() from t2; |
| 1435 |
f1() |
| 1436 |
1 |
| 1437 |
handler t1 read next; |
| 1438 |
i |
| 1439 |
2 |
| 1440 |
handler t1 close; |
| 1441 |
# Check that the same happens under GLOBAL READ LOCK. |
| 1442 |
flush tables with read lock; |
| 1443 |
handler t1 open; |
| 1444 |
handler t1 read next; |
| 1445 |
i |
| 1446 |
1 |
| 1447 |
select f1() from t2; |
| 1448 |
f1() |
| 1449 |
1 |
| 1450 |
handler t1 read next; |
| 1451 |
i |
| 1452 |
2 |
| 1453 |
unlock tables; |
| 1454 |
handler t1 close; |
| 1455 |
# Now, check that the same happens if LOCK TABLES is executed. |
| 1456 |
handler t1 open; |
| 1457 |
handler t1 read next; |
| 1458 |
i |
| 1459 |
1 |
| 1460 |
lock table t2 read; |
| 1461 |
select * from t2; |
| 1462 |
j |
| 1463 |
1 |
| 1464 |
unlock tables; |
| 1465 |
handler t1 read next; |
| 1466 |
i |
| 1467 |
2 |
| 1468 |
handler t1 close; |
| 1469 |
# Finally, check scenario with GRL and LOCK TABLES. |
| 1470 |
flush tables with read lock; |
| 1471 |
handler t1 open; |
| 1472 |
handler t1 read next; |
| 1473 |
i |
| 1474 |
1 |
| 1475 |
lock table t2 read; |
| 1476 |
select * from t2; |
| 1477 |
j |
| 1478 |
1 |
| 1479 |
# This unlocks both tables and GRL. |
| 1480 |
unlock tables; |
| 1481 |
handler t1 read next; |
| 1482 |
i |
| 1483 |
2 |
| 1484 |
handler t1 close; |
| 1485 |
# Clean-up. |
| 1486 |
drop function f1; |
| 1487 |
drop tables t1, t2; |
| 1488 |
# |
| 1489 |
# Test for bug #51136 "Crash in pthread_rwlock_rdlock on TEMPORARY + |
| 1490 |
# HANDLER + LOCK + SP". |
| 1491 |
# Also see additional coverage for this bug in flush.test. |
| 1492 |
# |
| 1493 |
drop tables if exists t1, t2; |
| 1494 |
create table t1 (i int); |
| 1495 |
create temporary table t2 (j int); |
| 1496 |
handler t1 open; |
| 1497 |
lock table t2 read; |
| 1498 |
# This commit should not release any MDL locks. |
| 1499 |
commit; |
| 1500 |
unlock tables; |
| 1501 |
# The below statement crashed before the bug fix as it |
| 1502 |
# has attempted to release metadata lock which was |
| 1503 |
# already released by commit. |
| 1504 |
handler t1 close; |
| 1505 |
drop tables t1, t2; |
| 1506 |
# |
| 1507 |
# Bug#51355 handler stmt cause assertion in |
| 1508 |
# bool MDL_context::try_acquire_lock(MDL_request*) |
| 1509 |
# |
| 1510 |
DROP TABLE IF EXISTS t1; |
| 1511 |
connect con51355, localhost, root; |
| 1512 |
connection default; |
| 1513 |
CREATE TABLE t1(id INT, KEY id(id)); |
| 1514 |
HANDLER t1 OPEN; |
| 1515 |
connection con51355; |
| 1516 |
# Sending: |
| 1517 |
DROP TABLE t1; |
| 1518 |
connection default; |
| 1519 |
# This I_S query will cause the handler table to be closed and |
| 1520 |
# the metadata lock to be released. This will allow DROP TABLE |
| 1521 |
# to proceed. Waiting for the table to be removed. |
| 1522 |
connection con51355; |
| 1523 |
# Reaping: DROP TABLE t1 |
| 1524 |
connection default; |
| 1525 |
HANDLER t1 READ id NEXT; |
| 1526 |
ERROR 42S02: Table 'test.t1' doesn't exist |
| 1527 |
HANDLER t1 READ id NEXT; |
| 1528 |
ERROR 42S02: Table 'test.t1' doesn't exist |
| 1529 |
HANDLER t1 CLOSE; |
| 1530 |
connection con51355; |
| 1531 |
disconnect con51355; |
| 1532 |
connection default; |
| 1533 |
# |
| 1534 |
# Bug#54401 assert in Diagnostics_area::set_eof_status , HANDLER |
| 1535 |
# |
| 1536 |
DROP TABLE IF EXISTS t1, t2; |
| 1537 |
DROP FUNCTION IF EXISTS f1; |
| 1538 |
CREATE FUNCTION f1() RETURNS INTEGER |
| 1539 |
BEGIN |
| 1540 |
SELECT 1 FROM t2 INTO @a; |
| 1541 |
RETURN 1; |
| 1542 |
END| |
| 1543 |
SELECT f1(); |
| 1544 |
ERROR 42S02: Table 'test.t2' doesn't exist |
| 1545 |
CREATE TABLE t1(a INT); |
| 1546 |
INSERT INTO t1 VALUES (1); |
| 1547 |
HANDLER t1 OPEN; |
| 1548 |
HANDLER t1 READ FIRST WHERE f1() = 1; |
| 1549 |
ERROR 42000: This version of MariaDB doesn't yet support 'stored functions in HANDLER ... READ' |
| 1550 |
HANDLER t1 CLOSE; |
| 1551 |
DROP FUNCTION f1; |
| 1552 |
DROP TABLE t1; |
| 1553 |
# |
| 1554 |
# Bug#54920 Stored functions are allowed in HANDLER statements, |
| 1555 |
# but broken. |
| 1556 |
# |
| 1557 |
DROP TABLE IF EXISTS t1; |
| 1558 |
DROP FUNCTION IF EXISTS f1; |
| 1559 |
CREATE TABLE t1 (a INT); |
| 1560 |
INSERT INTO t1 VALUES (1), (2); |
| 1561 |
CREATE FUNCTION f1() RETURNS INT RETURN 1; |
| 1562 |
HANDLER t1 OPEN; |
| 1563 |
HANDLER t1 READ FIRST WHERE f1() = 1; |
| 1564 |
ERROR 42000: This version of MariaDB doesn't yet support 'stored functions in HANDLER ... READ' |
| 1565 |
HANDLER t1 CLOSE; |
| 1566 |
DROP FUNCTION f1; |
| 1567 |
DROP TABLE t1; |
| 1568 |
# |
| 1569 |
# BUG#51877 - HANDLER interface causes invalid memory read |
| 1570 |
# |
| 1571 |
CREATE TABLE t1(a INT, KEY using btree (a)); |
| 1572 |
HANDLER t1 OPEN; |
| 1573 |
HANDLER t1 READ a FIRST; |
| 1574 |
a |
| 1575 |
INSERT INTO t1 VALUES(1); |
| 1576 |
HANDLER t1 READ a NEXT; |
| 1577 |
a |
| 1578 |
1 |
| 1579 |
HANDLER t1 CLOSE; |
| 1580 |
DROP TABLE t1; |
| 1581 |
# |
| 1582 |
# BUG #46456: HANDLER OPEN + TRUNCATE + DROP (temporary) TABLE, crash |
| 1583 |
# |
| 1584 |
CREATE TABLE t1 AS SELECT 1 AS f1; |
| 1585 |
HANDLER t1 OPEN; |
| 1586 |
TRUNCATE t1; |
| 1587 |
HANDLER t1 READ FIRST; |
| 1588 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 1589 |
DROP TABLE t1; |
| 1590 |
CREATE TEMPORARY TABLE t1 AS SELECT 1 AS f1; |
| 1591 |
HANDLER t1 OPEN; |
| 1592 |
TRUNCATE t1; |
| 1593 |
HANDLER t1 READ FIRST; |
| 1594 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 1595 |
DROP TABLE t1; |
| 1596 |
# |
| 1597 |
# Bug #54007: assert in ha_myisam::index_next , HANDLER |
| 1598 |
# |
| 1599 |
CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a), KEY b(b), KEY ab(a, b)); |
| 1600 |
HANDLER t1 OPEN; |
| 1601 |
HANDLER t1 READ FIRST; |
| 1602 |
a b |
| 1603 |
HANDLER t1 READ `PRIMARY` NEXT; |
| 1604 |
a b |
| 1605 |
HANDLER t1 READ ab NEXT; |
| 1606 |
a b |
| 1607 |
HANDLER t1 READ b NEXT; |
| 1608 |
a b |
| 1609 |
HANDLER t1 READ NEXT; |
| 1610 |
a b |
| 1611 |
HANDLER t1 CLOSE; |
| 1612 |
INSERT INTO t1 VALUES (2, 20), (1, 10), (4, 40), (3, 30); |
| 1613 |
HANDLER t1 OPEN; |
| 1614 |
HANDLER t1 READ FIRST; |
| 1615 |
a b |
| 1616 |
2 20 |
| 1617 |
HANDLER t1 READ NEXT; |
| 1618 |
a b |
| 1619 |
1 10 |
| 1620 |
HANDLER t1 READ `PRIMARY` NEXT; |
| 1621 |
a b |
| 1622 |
1 10 |
| 1623 |
HANDLER t1 READ `PRIMARY` NEXT; |
| 1624 |
a b |
| 1625 |
2 20 |
| 1626 |
HANDLER t1 READ ab NEXT; |
| 1627 |
a b |
| 1628 |
1 10 |
| 1629 |
HANDLER t1 READ ab NEXT; |
| 1630 |
a b |
| 1631 |
2 20 |
| 1632 |
HANDLER t1 READ b NEXT; |
| 1633 |
a b |
| 1634 |
1 10 |
| 1635 |
HANDLER t1 READ b NEXT; |
| 1636 |
a b |
| 1637 |
2 20 |
| 1638 |
HANDLER t1 READ b NEXT; |
| 1639 |
a b |
| 1640 |
3 30 |
| 1641 |
HANDLER t1 READ b NEXT; |
| 1642 |
a b |
| 1643 |
4 40 |
| 1644 |
HANDLER t1 READ b NEXT; |
| 1645 |
a b |
| 1646 |
HANDLER t1 READ NEXT; |
| 1647 |
a b |
| 1648 |
2 20 |
| 1649 |
HANDLER t1 READ NEXT; |
| 1650 |
a b |
| 1651 |
1 10 |
| 1652 |
HANDLER t1 READ NEXT; |
| 1653 |
a b |
| 1654 |
4 40 |
| 1655 |
HANDLER t1 CLOSE; |
| 1656 |
HANDLER t1 OPEN; |
| 1657 |
HANDLER t1 READ FIRST; |
| 1658 |
a b |
| 1659 |
2 20 |
| 1660 |
HANDLER t1 READ `PRIMARY` PREV; |
| 1661 |
a b |
| 1662 |
4 40 |
| 1663 |
HANDLER t1 READ `PRIMARY` PREV; |
| 1664 |
a b |
| 1665 |
3 30 |
| 1666 |
HANDLER t1 READ b PREV; |
| 1667 |
a b |
| 1668 |
4 40 |
| 1669 |
HANDLER t1 READ b PREV; |
| 1670 |
a b |
| 1671 |
3 30 |
| 1672 |
HANDLER t1 CLOSE; |
| 1673 |
HANDLER t1 OPEN; |
| 1674 |
HANDLER t1 READ FIRST; |
| 1675 |
a b |
| 1676 |
2 20 |
| 1677 |
HANDLER t1 READ `PRIMARY` PREV LIMIT 3; |
| 1678 |
a b |
| 1679 |
4 40 |
| 1680 |
3 30 |
| 1681 |
2 20 |
| 1682 |
HANDLER t1 READ b NEXT LIMIT 5; |
| 1683 |
a b |
| 1684 |
1 10 |
| 1685 |
2 20 |
| 1686 |
3 30 |
| 1687 |
4 40 |
| 1688 |
HANDLER t1 CLOSE; |
| 1689 |
DROP TABLE t1; |
| 1690 |
# |
| 1691 |
# Additional coverage for refactoring which is made as part |
| 1692 |
# of fix for bug #27480 "Extend CREATE TEMPORARY TABLES privilege |
| 1693 |
# to allow temp table operations". |
| 1694 |
# |
| 1695 |
# Check that DDL on temporary table properly closes HANDLER cursors |
| 1696 |
# for this table belonging to the same connection. |
| 1697 |
CREATE TEMPORARY TABLE t1 AS SELECT 1 AS f1; |
| 1698 |
# -- CREATE TABLE |
| 1699 |
HANDLER t1 OPEN; |
| 1700 |
CREATE TEMPORARY TABLE IF NOT EXISTS t1 SELECT 1 AS f1; |
| 1701 |
Warnings: |
| 1702 |
Note 1050 Table 't1' already exists |
| 1703 |
HANDLER t1 READ FIRST; |
| 1704 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 1705 |
# -- REPAIR TABLE |
| 1706 |
HANDLER t1 OPEN; |
| 1707 |
REPAIR TABLE t1; |
| 1708 |
Table Op Msg_type Msg_text |
| 1709 |
test.t1 repair status OK |
| 1710 |
HANDLER t1 READ FIRST; |
| 1711 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 1712 |
# -- ANALYZE TABLE |
| 1713 |
HANDLER t1 OPEN; |
| 1714 |
ANALYZE TABLE t1; |
| 1715 |
Table Op Msg_type Msg_text |
| 1716 |
test.t1 analyze status OK |
| 1717 |
HANDLER t1 READ FIRST; |
| 1718 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 1719 |
# -- OPTIMIZE TABLE |
| 1720 |
HANDLER t1 OPEN; |
| 1721 |
OPTIMIZE TABLE t1; |
| 1722 |
Table Op Msg_type Msg_text |
| 1723 |
test.t1 optimize status OK |
| 1724 |
HANDLER t1 READ FIRST; |
| 1725 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 1726 |
# -- CHECK TABLE |
| 1727 |
HANDLER t1 OPEN; |
| 1728 |
CHECK TABLE t1; |
| 1729 |
Table Op Msg_type Msg_text |
| 1730 |
test.t1 check status OK |
| 1731 |
HANDLER t1 READ FIRST; |
| 1732 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 1733 |
# -- ALTER TABLE |
| 1734 |
HANDLER t1 OPEN; |
| 1735 |
ALTER TABLE t1 ADD COLUMN b INT; |
| 1736 |
HANDLER t1 READ FIRST; |
| 1737 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 1738 |
# -- CREATE INDEX |
| 1739 |
HANDLER t1 OPEN; |
| 1740 |
CREATE INDEX b ON t1 (b); |
| 1741 |
HANDLER t1 READ FIRST; |
| 1742 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 1743 |
# -- DROP INDEX |
| 1744 |
HANDLER t1 OPEN; |
| 1745 |
DROP INDEX b ON t1; |
| 1746 |
HANDLER t1 READ FIRST; |
| 1747 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 1748 |
# -- TRUNCATE TABLE |
| 1749 |
HANDLER t1 OPEN; |
| 1750 |
TRUNCATE TABLE t1; |
| 1751 |
HANDLER t1 READ FIRST; |
| 1752 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 1753 |
# -- DROP TABLE |
| 1754 |
HANDLER t1 OPEN; |
| 1755 |
DROP TABLE t1; |
| 1756 |
HANDLER t1 READ FIRST; |
| 1757 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 1758 |
CREATE TEMPORARY TABLE t1(a INT, b INT, INDEX i(a)); |
| 1759 |
set global keycache1.key_cache_block_size=2048; |
| 1760 |
set global keycache1.key_buffer_size=1*1024*1024; |
| 1761 |
set global keycache1.key_buffer_size=1024*1024; |
| 1762 |
# -- CACHE INDEX |
| 1763 |
HANDLER t1 OPEN; |
| 1764 |
CACHE INDEX t1 IN keycache1; |
| 1765 |
Table Op Msg_type Msg_text |
| 1766 |
test.t1 assign_to_keycache status OK |
| 1767 |
HANDLER t1 READ FIRST; |
| 1768 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 1769 |
# -- LOAD INDEX |
| 1770 |
HANDLER t1 OPEN; |
| 1771 |
LOAD INDEX INTO CACHE t1; |
| 1772 |
Table Op Msg_type Msg_text |
| 1773 |
test.t1 preload_keys status OK |
| 1774 |
HANDLER t1 READ FIRST; |
| 1775 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 1776 |
End of 5.1 tests |
| 1777 |
# |
| 1778 |
# 10.2 Test |
| 1779 |
# |
| 1780 |
# MDEV-20207: Assertion `! is_set()' failed in |
| 1781 |
# Diagnostics_area::set_eof_status upon HANDLER READ |
| 1782 |
# |
| 1783 |
DROP TABLE IF EXISTS t1; |
| 1784 |
CREATE TABLE t1 (a POINT, KEY(a)); |
| 1785 |
HANDLER t1 OPEN h; |
| 1786 |
HANDLER h READ a = (0); |
| 1787 |
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field |
| 1788 |
HANDLER h CLOSE; |
| 1789 |
DROP TABLE t1; |
| 1790 |
# End of 10.2 Test |