Debian Codegraph @

mysql-test/suite/handler/heap.result

raw
1 SET SESSION DEFAULT_STORAGE_ENGINE = MEMORY;
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 = MEMORY;
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=MEMORY;
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 note The storage engine for the table doesn't support optimize
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 note The storage engine for the table doesn't support optimize
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 Operation failed
812 handler t1 read next;
813 ERROR 42S02: Unknown table 't1' in HANDLER
814 #
815 # OPTIMIZE TABLE
816 #
817 handler t1 open;
818 optimize table t1;
819 Table Op Msg_type Msg_text
820 test.t1 optimize note The storage engine for the table doesn't support optimize
821 handler t1 read next;
822 ERROR 42S02: Unknown table 't1' in HANDLER
823 #
824 # REPAIR TABLE
825 #
826 handler t1 open;
827 repair table t1;
828 Table Op Msg_type Msg_text
829 test.t1 repair status OK
830 handler t1 read next;
831 ERROR 42S02: Unknown table 't1' in HANDLER
832 #
833 # DROP TABLE, naturally.
834 #
835 handler t1 open;
836 drop table t1;
837 handler t1 read next;
838 ERROR 42S02: Unknown table 't1' in HANDLER
839 create table t1 (a int, b int, key a using btree (a)) select a from t2;
840 #
841 # RENAME TABLE, naturally
842 #
843 handler t1 open;
844 rename table t1 to t3;
845 handler t1 read next;
846 ERROR 42S02: Unknown table 't1' in HANDLER
847 #
848 # CREATE TABLE (even with IF NOT EXISTS clause,
849 # and the table exists).
850 #
851 handler t2 open;
852 create table if not exists t2 (a int);
853 Warnings:
854 Note 1050 Table 't2' already exists
855 handler t2 read next;
856 ERROR 42S02: Unknown table 't2' in HANDLER
857 rename table t3 to t1;
858 drop table t2;
859 #
860 # FLUSH TABLE doesn't close the table but loses the position
861 #
862 handler t1 open;
863 handler t1 read a prev;
864 b a
865 NULL 5
866 flush table t1;
867 handler t1 read a prev;
868 b a
869 NULL 5
870 handler t1 close;
871 #
872 # FLUSH TABLES WITH READ LOCK behaves like FLUSH TABLE.
873 #
874 handler t1 open;
875 handler t1 read a prev;
876 b a
877 NULL 5
878 flush tables with read lock;
879 handler t1 read a prev;
880 b a
881 NULL 5
882 handler t1 close;
883 unlock tables;
884 #
885 # Let us also check that these operations behave in similar
886 # way under LOCK TABLES.
887 #
888 # TRUNCATE under LOCK TABLES.
889 #
890 handler t1 open;
891 lock tables t1 write;
892 truncate table t1;
893 unlock tables;
894 handler t1 read next;
895 ERROR 42S02: Unknown table 't1' in HANDLER
896 handler t1 open;
897 #
898 # CREATE TRIGGER under LOCK TABLES.
899 #
900 lock tables t1 write;
901 create trigger t1_ai after insert on t1 for each row set @a=1;
902 unlock tables;
903 handler t1 read next;
904 ERROR 42S02: Unknown table 't1' in HANDLER
905 #
906 # DROP TRIGGER under LOCK TABLES.
907 #
908 handler t1 open;
909 lock tables t1 write;
910 drop trigger t1_ai;
911 unlock tables;
912 handler t1 read next;
913 ERROR 42S02: Unknown table 't1' in HANDLER
914 #
915 # ALTER TABLE under LOCK TABLES.
916 #
917 handler t1 open;
918 lock tables t1 write;
919 alter table t1 drop column b;
920 unlock tables;
921 handler t1 read next;
922 ERROR 42S02: Unknown table 't1' in HANDLER
923 #
924 # ANALYZE TABLE under LOCK TABLES.
925 #
926 handler t1 open;
927 lock tables t1 write;
928 analyze table t1;
929 Table Op Msg_type Msg_text
930 test.t1 analyze status Engine-independent statistics collected
931 test.t1 analyze note The storage engine for the table doesn't support analyze
932 unlock tables;
933 handler t1 read next;
934 ERROR 42S02: Unknown table 't1' in HANDLER
935 #
936 # OPTIMIZE TABLE under LOCK TABLES.
937 #
938 handler t1 open;
939 lock tables t1 write;
940 optimize table t1;
941 Table Op Msg_type Msg_text
942 test.t1 optimize note The storage engine for the table doesn't support optimize
943 unlock tables;
944 handler t1 read next;
945 ERROR 42S02: Unknown table 't1' in HANDLER
946 #
947 # REPAIR TABLE under LOCK TABLES.
948 #
949 handler t1 open;
950 lock tables t1 write;
951 repair table t1;
952 Table Op Msg_type Msg_text
953 test.t1 repair status OK
954 unlock tables;
955 handler t1 read next;
956 ERROR 42S02: Unknown table 't1' in HANDLER
957 #
958 # DROP TABLE under LOCK TABLES, naturally.
959 #
960 handler t1 open;
961 lock tables t1 write;
962 drop table t1;
963 unlock tables;
964 handler t1 read next;
965 ERROR 42S02: Unknown table 't1' in HANDLER
966 create table t1 (a int, b int, key a using btree (a));
967 insert into t1 (a) values (1), (2), (3), (4), (5);
968 #
969 # FLUSH TABLE doesn't close the table but loses the position
970 #
971 handler t1 open;
972 handler t1 read a prev;
973 a b
974 5 NULL
975 lock tables t1 write;
976 flush table t1;
977 unlock tables;
978 handler t1 read a prev;
979 a b
980 5 NULL
981 handler t1 close;
982 #
983 # Explore the effect of HANDLER locks on concurrent DDL
984 #
985 handler t1 open;
986 connect con1, localhost, root,,;
987 connect con2, localhost, root,,;
988 connect con3, localhost, root,,;
989 connection con1;
990 # Sending:
991 drop table t1 ;
992 # We can't use connection 'default' as wait_condition will
993 # autoclose handlers.
994 connection con2;
995 # Waitng for 'drop table t1' to get blocked...
996 connection default;
997 handler t1 read a prev;
998 a b
999 5 NULL
1000 handler t1 read a prev;
1001 a b
1002 4 NULL
1003 handler t1 close;
1004 connection con1;
1005 # Reaping 'drop table t1'...
1006 connection default;
1007 #
1008 # Explore the effect of HANDLER locks in parallel with SELECT
1009 #
1010 create table t1 (a int, key a using btree (a));
1011 insert into t1 (a) values (1), (2), (3), (4), (5);
1012 begin;
1013 select * from t1;
1014 a
1015 1
1016 2
1017 3
1018 4
1019 5
1020 handler t1 open;
1021 handler t1 read a prev;
1022 a
1023 5
1024 handler t1 read a prev;
1025 a
1026 4
1027 handler t1 close;
1028 connection con1;
1029 # Sending:
1030 drop table t1 ;
1031 connection con2;
1032 # Waiting for 'drop table t1' to get blocked...
1033 connection default;
1034 # We can still use the table, it's part of the transaction
1035 select * from t1;
1036 a
1037 1
1038 2
1039 3
1040 4
1041 5
1042 # Such are the circumstances that t1 is a part of transaction,
1043 # thus we can reopen it in the handler
1044 handler t1 open;
1045 # We can commit the transaction, it doesn't close the handler
1046 # and doesn't let DROP to proceed.
1047 commit;
1048 handler t1 read a prev;
1049 a
1050 5
1051 handler t1 read a prev;
1052 a
1053 4
1054 handler t1 read a prev;
1055 a
1056 3
1057 handler t1 close;
1058 connection con1;
1059 # Now drop can proceed
1060 # Reaping 'drop table t1'...
1061 connection default;
1062 #
1063 # Demonstrate that HANDLER locks and transaction locks
1064 # reside in the same context.
1065 #
1066 create table t1 (a int, key a (a));
1067 insert into t1 (a) values (1), (2), (3), (4), (5);
1068 create table t0 (a int, key a using btree (a));
1069 insert into t0 (a) values (1), (2), (3), (4), (5);
1070 begin;
1071 select * from t1;
1072 a
1073 1
1074 2
1075 3
1076 4
1077 5
1078 connection con2;
1079 # Sending:
1080 rename table t0 to t3, t1 to t0, t3 to t1;
1081 connection con1;
1082 # Waiting for 'rename table ...' to get blocked...
1083 connection default;
1084 # We back-off on hitting deadlock condition.
1085 handler t0 open;
1086 ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
1087 select * from t0;
1088 a
1089 1
1090 2
1091 3
1092 4
1093 5
1094 handler t1 open;
1095 commit;
1096 handler t1 close;
1097 connection con2;
1098 # Reaping 'rename table ...'...
1099 connection default;
1100 handler t1 open;
1101 handler t1 read a prev;
1102 a
1103 5
1104 handler t1 close;
1105 drop table t0;
1106 #
1107 # Originally there was a deadlock error in this test.
1108 # With implementation of deadlock detector
1109 # we no longer deadlock, but block and wait on a lock.
1110 # The HANDLER is auto-closed as soon as the connection
1111 # sees a pending conflicting lock against it.
1112 #
1113 create table t2 (a int, key a (a));
1114 handler t1 open;
1115 connection con1;
1116 lock tables t2 read;
1117 connection con2;
1118 # Sending 'drop table t2'...
1119 drop table t2;
1120 connection con1;
1121 # Waiting for 'drop table t2' to get blocked...
1122 connection default;
1123 # Sending 'select * from t2'
1124 select * from t2;
1125 connection con1;
1126 # Waiting for 'select * from t2' to get blocked...
1127 unlock tables;
1128 connection con2;
1129 # Reaping 'drop table t2'...
1130 connection default;
1131 # Reaping 'select * from t2'
1132 ERROR 42S02: Table 'test.t2' doesn't exist
1133 handler t1 close;
1134 drop table t1;
1135 #
1136 # If we have to wait on an exclusive locks while having
1137 # an open HANDLER, ER_LOCK_DEADLOCK is reported.
1138 #
1139 create table t1 (a int, key a(a));
1140 handler t1 open;
1141 connection con1;
1142 select get_lock('lock1', 10);
1143 get_lock('lock1', 10)
1144 1
1145 connection default;
1146 select get_lock('lock1', 10);
1147 connection con2;
1148 # Waiting for 'select get_lock('lock1', 10)' to get blocked...
1149 connection con1;
1150 drop table t1;
1151 ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
1152 select release_lock('lock1');
1153 release_lock('lock1')
1154 1
1155 connection default;
1156 get_lock('lock1', 10)
1157 1
1158 select release_lock('lock1');
1159 release_lock('lock1')
1160 1
1161 # Demonstrate that there is no deadlock with FLUSH TABLE,
1162 # even though it is waiting for the other table to go away
1163 create table t2 like t1;
1164 # Sending:
1165 flush table t2;
1166 connection con2;
1167 drop table t1;
1168 connection con1;
1169 unlock tables;
1170 connection default;
1171 # Reaping 'flush table t2'...
1172 drop table t2;
1173 #
1174 # Bug #46224 HANDLER statements within a transaction might
1175 # lead to deadlocks
1176 #
1177 create table t1 (a int, key using btree (a));
1178 insert into t1 values (1), (2);
1179 connection default;
1180 begin;
1181 select * from t1;
1182 a
1183 1
1184 2
1185 handler t1 open;
1186 connection con1;
1187 # Sending:
1188 lock tables t1 write;
1189 connection con2;
1190 # Check that 'lock tables t1 write' waits until transaction which
1191 # has read from the table commits.
1192 connection default;
1193 # The below 'handler t1 read ...' should not be blocked as
1194 # 'lock tables t1 write' has not succeeded yet.
1195 handler t1 read a next;
1196 a
1197 1
1198 # Unblock 'lock tables t1 write'.
1199 select * from t1;
1200 a
1201 1
1202 2
1203 commit;
1204 connection con1;
1205 # Reap 'lock tables t1 write'.
1206 connection default;
1207 # Sending:
1208 handler t1 read a next;
1209 connection con1;
1210 # Waiting for 'handler t1 read a next' to get blocked...
1211 # The below 'drop table t1' should be able to proceed without
1212 # waiting as it will force HANDLER to be closed.
1213 drop table t1;
1214 unlock tables;
1215 connection default;
1216 # Reaping 'handler t1 read a next'...
1217 ERROR 42S02: Table 'test.t1' doesn't exist
1218 handler t1 close;
1219 connection con1;
1220 disconnect con1;
1221 connection con2;
1222 disconnect con2;
1223 connection con3;
1224 disconnect con3;
1225 connection default;
1226 #
1227 # A temporary table test.
1228 # Check that we don't loose positions of HANDLER opened
1229 # against a temporary table.
1230 #
1231 create table t1 (a int, b int, key using btree (a));
1232 insert into t1 (a) values (1), (2), (3), (4), (5);
1233 create temporary table t2 (a int, b int, key using btree (a));
1234 insert into t2 (a) select a from t1;
1235 handler t1 open;
1236 handler t1 read a next;
1237 a b
1238 1 NULL
1239 handler t2 open;
1240 handler t2 read a next;
1241 a b
1242 1 NULL
1243 flush table t1;
1244 handler t2 read a next;
1245 a b
1246 2 NULL
1247 # Sic: the position is lost
1248 handler t1 read a next;
1249 a b
1250 1 NULL
1251 select * from t1;
1252 a b
1253 1 NULL
1254 2 NULL
1255 3 NULL
1256 4 NULL
1257 5 NULL
1258 # Sic: the position is not lost
1259 handler t2 read a next;
1260 a b
1261 3 NULL
1262 select * from t2;
1263 a b
1264 1 NULL
1265 2 NULL
1266 3 NULL
1267 4 NULL
1268 5 NULL
1269 handler t2 read a next;
1270 a b
1271 4 NULL
1272 drop table t1;
1273 drop temporary table t2;
1274 #
1275 # A test for lock_table_names()/unlock_table_names() function.
1276 # It should work properly in presence of open HANDLER.
1277 #
1278 create table t1 (a int, b int, key a (a));
1279 create table t2 like t1;
1280 create table t3 like t1;
1281 create table t4 like t1;
1282 handler t1 open;
1283 handler t2 open;
1284 rename table t4 to t5, t3 to t4, t5 to t3;
1285 handler t1 read first;
1286 a b
1287 handler t2 read first;
1288 a b
1289 drop table t1, t2, t3, t4;
1290 #
1291 # A test for FLUSH TABLES WITH READ LOCK and HANDLER statements.
1292 #
1293 set autocommit=0;
1294 create table t1 (a int, b int, key a (a));
1295 insert into t1 (a, b) values (1, 1), (2, 1), (3, 2), (4, 2), (5, 5);
1296 create table t2 like t1;
1297 insert into t2 (a, b) select a, b from t1;
1298 create table t3 like t1;
1299 insert into t3 (a, b) select a, b from t1;
1300 commit;
1301 flush tables with read lock;
1302 handler t1 open;
1303 lock table t1 read;
1304 handler t1 read next;
1305 ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
1306 # This implicitly leaves LOCK TABLES but doesn't drop the GLR
1307 lock table not_exists_write read;
1308 ERROR 42S02: Table 'test.not_exists_write' doesn't exist
1309 # We still have the read lock.
1310 drop table t1;
1311 ERROR HY000: Can't execute the query because you have a conflicting read lock
1312 handler t1 open;
1313 select a from t2;
1314 a
1315 1
1316 2
1317 3
1318 4
1319 5
1320 handler t1 read next;
1321 a b
1322 1 1
1323 flush tables with read lock;
1324 handler t2 open;
1325 flush tables with read lock;
1326 handler t1 read next;
1327 a b
1328 2 1
1329 select a from t3;
1330 a
1331 1
1332 2
1333 3
1334 4
1335 5
1336 handler t2 read next;
1337 a b
1338 1 1
1339 handler t1 close;
1340 rollback;
1341 handler t2 close;
1342 drop table t1;
1343 ERROR HY000: Can't execute the query because you have a conflicting read lock
1344 commit;
1345 flush tables;
1346 drop table t1;
1347 ERROR HY000: Can't execute the query because you have a conflicting read lock
1348 unlock tables;
1349 drop table t1;
1350 set autocommit=default;
1351 drop table t2, t3;
1352 #
1353 # HANDLER statement and operation-type aware metadata locks.
1354 # Check that when we clone a ticket for HANDLER we downrade
1355 # the lock.
1356 #
1357 connect con1,localhost,root,,;
1358 connection default;
1359 create table t1 (a int, b int, key using btree (a));
1360 insert into t1 (a, b) values (1, 1), (2, 1), (3, 2), (4, 2), (5, 5);
1361 begin;
1362 insert into t1 (a, b) values (6, 6);
1363 handler t1 open;
1364 handler t1 read a last;
1365 a b
1366 6 6
1367 insert into t1 (a, b) values (7, 7);
1368 handler t1 read a last;
1369 a b
1370 7 7
1371 commit;
1372 connection default;
1373 handler t1 read a prev;
1374 a b
1375 6 6
1376 handler t1 close;
1377 # Cleanup.
1378 drop table t1;
1379 connection con1;
1380 disconnect con1;
1381 connection default;
1382 #
1383 # A test for Bug#50555 "handler commands crash server in
1384 # my_hash_first()".
1385 #
1386 handler no_such_table read no_such_index first;
1387 ERROR 42S02: Unknown table 'no_such_table' in HANDLER
1388 handler no_such_table close;
1389 ERROR 42S02: Unknown table 'no_such_table' in HANDLER
1390 #
1391 # Bug#50907 Assertion `hash_tables->table->next == __null' on
1392 # HANDLER OPEN
1393 #
1394 DROP TABLE IF EXISTS t1, t2;
1395 CREATE TEMPORARY TABLE t1 (i INT);
1396 CREATE TEMPORARY TABLE t2 (i INT);
1397 HANDLER t2 OPEN;
1398 HANDLER t2 READ FIRST;
1399 i
1400 HANDLER t2 CLOSE;
1401 DROP TABLE t1, t2;
1402 #
1403 # Bug#50912 Assertion `ticket->m_type >= mdl_request->type'
1404 # failed on HANDLER + I_S
1405 #
1406 DROP TABLE IF EXISTS t1;
1407 CREATE TABLE t1 (id INT);
1408 HANDLER t1 OPEN;
1409 SELECT table_name, table_comment FROM information_schema.tables
1410 WHERE table_schema= 'test' AND table_name= 't1';
1411 table_name table_comment
1412 t1
1413 HANDLER t1 CLOSE;
1414 DROP TABLE t1;
1415 #
1416 # Test for bug #50908 "Assertion `handler_tables_hash.records == 0'
1417 # failed in enter_locked_tables_mode".
1418 #
1419 drop tables if exists t1, t2;
1420 drop function if exists f1;
1421 create table t1 (i int);
1422 insert into t1 values (1), (2);
1423 create table t2 (j int);
1424 insert into t2 values (1);
1425 create function f1() returns int return (select count(*) from t2);
1426 # Check that open HANDLER survives statement executed in
1427 # prelocked mode.
1428 handler t1 open;
1429 handler t1 read next;
1430 i
1431 1
1432 # The below statement were aborted due to an assertion failure.
1433 select f1() from t2;
1434 f1()
1435 1
1436 handler t1 read next;
1437 i
1438 2
1439 handler t1 close;
1440 # Check that the same happens under GLOBAL READ LOCK.
1441 flush tables with read lock;
1442 handler t1 open;
1443 handler t1 read next;
1444 i
1445 1
1446 select f1() from t2;
1447 f1()
1448 1
1449 handler t1 read next;
1450 i
1451 2
1452 unlock tables;
1453 handler t1 close;
1454 # Now, check that the same happens if LOCK TABLES is executed.
1455 handler t1 open;
1456 handler t1 read next;
1457 i
1458 1
1459 lock table t2 read;
1460 select * from t2;
1461 j
1462 1
1463 unlock tables;
1464 handler t1 read next;
1465 i
1466 2
1467 handler t1 close;
1468 # Finally, check scenario with GRL and LOCK TABLES.
1469 flush tables with read lock;
1470 handler t1 open;
1471 handler t1 read next;
1472 i
1473 1
1474 lock table t2 read;
1475 select * from t2;
1476 j
1477 1
1478 # This unlocks both tables and GRL.
1479 unlock tables;
1480 handler t1 read next;
1481 i
1482 2
1483 handler t1 close;
1484 # Clean-up.
1485 drop function f1;
1486 drop tables t1, t2;
1487 #
1488 # Test for bug #51136 "Crash in pthread_rwlock_rdlock on TEMPORARY +
1489 # HANDLER + LOCK + SP".
1490 # Also see additional coverage for this bug in flush.test.
1491 #
1492 drop tables if exists t1, t2;
1493 create table t1 (i int);
1494 create temporary table t2 (j int);
1495 handler t1 open;
1496 lock table t2 read;
1497 # This commit should not release any MDL locks.
1498 commit;
1499 unlock tables;
1500 # The below statement crashed before the bug fix as it
1501 # has attempted to release metadata lock which was
1502 # already released by commit.
1503 handler t1 close;
1504 drop tables t1, t2;
1505 #
1506 # Bug#51355 handler stmt cause assertion in
1507 # bool MDL_context::try_acquire_lock(MDL_request*)
1508 #
1509 DROP TABLE IF EXISTS t1;
1510 connect con51355, localhost, root;
1511 connection default;
1512 CREATE TABLE t1(id INT, KEY id(id));
1513 HANDLER t1 OPEN;
1514 connection con51355;
1515 # Sending:
1516 DROP TABLE t1;
1517 connection default;
1518 # This I_S query will cause the handler table to be closed and
1519 # the metadata lock to be released. This will allow DROP TABLE
1520 # to proceed. Waiting for the table to be removed.
1521 connection con51355;
1522 # Reaping: DROP TABLE t1
1523 connection default;
1524 HANDLER t1 READ id NEXT;
1525 ERROR 42S02: Table 'test.t1' doesn't exist
1526 HANDLER t1 READ id NEXT;
1527 ERROR 42S02: Table 'test.t1' doesn't exist
1528 HANDLER t1 CLOSE;
1529 connection con51355;
1530 disconnect con51355;
1531 connection default;
1532 #
1533 # Bug#54401 assert in Diagnostics_area::set_eof_status , HANDLER
1534 #
1535 DROP TABLE IF EXISTS t1, t2;
1536 DROP FUNCTION IF EXISTS f1;
1537 CREATE FUNCTION f1() RETURNS INTEGER
1538 BEGIN
1539 SELECT 1 FROM t2 INTO @a;
1540 RETURN 1;
1541 END|
1542 SELECT f1();
1543 ERROR 42S02: Table 'test.t2' doesn't exist
1544 CREATE TABLE t1(a INT);
1545 INSERT INTO t1 VALUES (1);
1546 HANDLER t1 OPEN;
1547 HANDLER t1 READ FIRST WHERE f1() = 1;
1548 ERROR 42000: This version of MariaDB doesn't yet support 'stored functions in HANDLER ... READ'
1549 HANDLER t1 CLOSE;
1550 DROP FUNCTION f1;
1551 DROP TABLE t1;
1552 #
1553 # Bug#54920 Stored functions are allowed in HANDLER statements,
1554 # but broken.
1555 #
1556 DROP TABLE IF EXISTS t1;
1557 DROP FUNCTION IF EXISTS f1;
1558 CREATE TABLE t1 (a INT);
1559 INSERT INTO t1 VALUES (1), (2);
1560 CREATE FUNCTION f1() RETURNS INT RETURN 1;
1561 HANDLER t1 OPEN;
1562 HANDLER t1 READ FIRST WHERE f1() = 1;
1563 ERROR 42000: This version of MariaDB doesn't yet support 'stored functions in HANDLER ... READ'
1564 HANDLER t1 CLOSE;
1565 DROP FUNCTION f1;
1566 DROP TABLE t1;
1567 #
1568 # BUG#51877 - HANDLER interface causes invalid memory read
1569 #
1570 CREATE TABLE t1(a INT, KEY using btree (a));
1571 HANDLER t1 OPEN;
1572 HANDLER t1 READ a FIRST;
1573 a
1574 INSERT INTO t1 VALUES(1);
1575 HANDLER t1 READ a NEXT;
1576 HANDLER t1 CLOSE;
1577 DROP TABLE t1;
1578 connect con1,localhost,root,,;
1579 connection default;
1580 CREATE TABLE t1(a INT, b INT, KEY(a), KEY b using btree (b), KEY ab using btree(a, b)) engine=memory;
1581 INSERT INTO t1 VALUES (2, 20), (2,20), (1, 10), (4, 40), (3, 30), (5,50), (6,50);
1582 HANDLER t1 OPEN;
1583 HANDLER t1 READ a=(2) limit 3;
1584 a b
1585 2 20
1586 2 20
1587 HANDLER t1 READ a PREV;
1588 a b
1589 2 20
1590 HANDLER t1 READ a PREV;
1591 a b
1592 2 20
1593 HANDLER t1 READ a PREV;
1594 a b
1595 HANDLER t1 READ b>=(20) limit 3;
1596 a b
1597 2 20
1598 2 20
1599 3 30
1600 HANDLER t1 READ b PREV;
1601 a b
1602 2 20
1603 HANDLER t1 READ b PREV LIMIT 2;
1604 a b
1605 2 20
1606 1 10
1607 HANDLER t1 READ ab=(3,30) limit 3;
1608 a b
1609 3 30
1610 HANDLER t1 READ ab>=(3,30) limit 3;
1611 a b
1612 3 30
1613 4 40
1614 5 50
1615 HANDLER t1 READ a FIRST;
1616 ERROR HY000: Storage engine MEMORY of the table `test`.`t1` doesn't have this option
1617 HANDLER t1 READ a LAST;
1618 ERROR HY000: Storage engine MEMORY of the table `test`.`t1` doesn't have this option
1619 HANDLER t1 READ b FIRST LIMIT 2;
1620 a b
1621 1 10
1622 2 20
1623 HANDLER t1 READ ab LAST LIMIT 2;
1624 a b
1625 6 50
1626 5 50
1627 HANDLER t1 READ FIRST LIMIT 10;
1628 a b
1629 2 20
1630 2 20
1631 1 10
1632 4 40
1633 3 30
1634 5 50
1635 6 50
1636 HANDLER t1 READ b FIRST;
1637 a b
1638 1 10
1639 insert into t1 values (7,50);
1640 HANDLER t1 READ b NEXT;
1641 ERROR HY000: Record has changed since last read in table 't1'; try restarting transaction
1642 HANDLER t1 READ b FIRST;
1643 a b
1644 1 10
1645 connection con1;
1646 insert into t1 values (7,50);
1647 connection default;
1648 HANDLER t1 READ b NEXT;
1649 ERROR HY000: Record has changed since last read in table 't1'; try restarting transaction
1650 HANDLER t1 READ FIRST;
1651 a b
1652 2 20
1653 connection con1;
1654 insert into t1 values (8,50);
1655 connection default;
1656 HANDLER t1 READ NEXT;
1657 a b
1658 2 20
1659 connection con1;
1660 delete from t1 where a=3;
1661 connection default;
1662 HANDLER t1 READ NEXT LIMIT 2;
1663 a b
1664 1 10
1665 4 40
1666 connection con1;
1667 delete from t1;
1668 connection default;
1669 HANDLER t1 READ NEXT LIMIT 2;
1670 ERROR HY000: Record has changed since last read in table 't1'; try restarting transaction
1671 HANDLER t1 CLOSE;
1672 DROP TABLE t1;
1673 disconnect con1;
1674 create table t1 (f1 integer not null, key (f1)) engine=Memory;
1675 insert into t1 values (1);
1676 HANDLER t1 OPEN;
1677 HANDLER t1 READ f1 NEXT;
1678 ERROR HY000: Storage engine MEMORY of the table `test`.`t1` doesn't have this option
1679 HANDLER t1 READ f1 NEXT;
1680 ERROR HY000: Storage engine MEMORY of the table `test`.`t1` doesn't have this option
1681 HANDLER t1 READ f1 NEXT;
1682 ERROR HY000: Storage engine MEMORY of the table `test`.`t1` doesn't have this option
1683 HANDLER t1 CLOSE;
1684 DROP TABLE t1;
1685 End of 5.3 tests
1686 #
1687 # MDEV-15813 ASAN use-after-poison in hp_hashnr upon
1688 # HANDLER READ on a versioned HEAP table
1689 #
1690 CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, CONSTRAINT PRIMARY KEY (a, b), UNIQUE ba(b, a) USING HASH) ENGINE=HEAP;
1691 INSERT INTO t1 VALUES (1, 10), (2, 20), (3,30), (4,40);
1692 HANDLER t1 OPEN AS m;
1693 HANDLER m READ `PRIMARY`= (3,30);
1694 a b
1695 3 30
1696 HANDLER m READ `PRIMARY`> (3,30);
1697 ERROR HY000: HASH index `PRIMARY` does not support this operation
1698 HANDLER m READ `ba`= (30,3);
1699 a b
1700 3 30
1701 HANDLER m READ `ba`= (30);
1702 ERROR HY000: HASH index `ba` does not support this operation
1703 HANDLER m CLOSE;
1704 DROP TABLE t1;