~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
set sql_mode=no_engine_substitution;
2
set storage_engine = InnoDB;
3
set autocommit=1;
4
drop table if exists t1;
5
drop table if exists t2;
6
drop table if exists t3;
7
drop function if exists f2;
8
drop procedure if exists bug12713_call;
9
drop procedure if exists bug12713_dump_spvars;
10
drop procedure if exists dummy;
11
create table t1 (a int);
12
create table t2 (a int unique);
13
create table t3 (a int);
14
set sql_mode=default;
15
insert into t1 (a) values (1), (2);
16
insert into t3 (a) values (1), (2);
17
create function f2(x int) returns int
18
begin
19
insert into t2 (a) values (x);
20
insert into t2 (a) values (x);
21
return x;
22
end|
23
set autocommit=0;
24
flush status;
25
insert into t2 (a) values (1001);
26
insert into t1 (a) values (f2(1));
27
ERROR 23000: Duplicate entry '1' for key 'a'
28
select * from t2;
29
a
30
1001
31
rollback;
32
select * from t2;
33
a
34
insert into t2 (a) values (1002);
35
insert into t3 (a) select f2(2) from t1;
36
ERROR 23000: Duplicate entry '2' for key 'a'
37
select * from t2;
38
a
39
1002
40
rollback;
41
select * from t2;
42
a
43
insert into t2 (a) values (1003);
44
update t1 set a= a + f2(3);
45
ERROR 23000: Duplicate entry '3' for key 'a'
46
select * from t2;
47
a
48
1003
49
rollback;
50
select * from t2;
51
a
52
insert into t2 (a) values (1004);
53
update t1, t3 set t1.a = 0, t3.a = 0 where (f2(4) = 4) and (t1.a = t3.a);
54
ERROR 23000: Duplicate entry '4' for key 'a'
55
select * from t2;
56
a
57
1004
58
rollback;
59
select * from t2;
60
a
61
insert into t2 (a) values (1005);
62
delete from t1 where (a = f2(5));
63
ERROR 23000: Duplicate entry '5' for key 'a'
64
select * from t2;
65
a
66
1005
67
rollback;
68
select * from t2;
69
a
70
insert into t2 (a) values (1006);
71
delete from t1, t3 using t1, t3 where (f2(6) = 6) ;
72
ERROR 23000: Duplicate entry '6' for key 'a'
73
select * from t2;
74
a
75
1006
76
rollback;
77
select * from t2;
78
a
79
insert into t2 (a) values (1007);
80
replace t1 values (f2(7));
81
ERROR 23000: Duplicate entry '7' for key 'a'
82
select * from t2;
83
a
84
1007
85
rollback;
86
select * from t2;
87
a
88
insert into t2 (a) values (1008);
89
replace into t3 (a) select f2(8) from t1;
90
ERROR 23000: Duplicate entry '8' for key 'a'
91
select * from t2;
92
a
93
1008
94
rollback;
95
select * from t2;
96
a
97
insert into t2 (a) values (1009);
98
select f2(9) from t1 ;
99
ERROR 23000: Duplicate entry '9' for key 'a'
100
select * from t2;
101
a
102
1009
103
rollback;
104
select * from t2;
105
a
106
insert into t2 (a) values (1010);
107
show databases where (f2(10) = 10);
108
ERROR 23000: Duplicate entry '10' for key 'a'
109
select * from t2;
110
a
111
1010
112
rollback;
113
select * from t2;
114
a
115
insert into t2 (a) values (1011);
116
show tables where (f2(11) = 11);
117
ERROR 23000: Duplicate entry '11' for key 'a'
118
select * from t2;
119
a
120
1011
121
rollback;
122
select * from t2;
123
a
124
insert into t2 (a) values (1012);
125
show triggers where (f2(12) = 12);
126
ERROR 23000: Duplicate entry '12' for key 'a'
127
select * from t2;
128
a
129
1012
130
rollback;
131
select * from t2;
132
a
133
insert into t2 (a) values (1013);
134
show table status where (f2(13) = 13);
135
ERROR 23000: Duplicate entry '13' for key 'a'
136
select * from t2;
137
a
138
1013
139
rollback;
140
select * from t2;
141
a
142
insert into t2 (a) values (1014);
143
show open tables where (f2(14) = 14);
144
ERROR 23000: Duplicate entry '14' for key 'a'
145
select * from t2;
146
a
147
1014
148
rollback;
149
select * from t2;
150
a
151
insert into t2 (a) values (1015);
152
show columns in mysql.proc where (f2(15) = 15);
153
ERROR 23000: Duplicate entry '15' for key 'a'
154
select * from t2;
155
a
156
1015
157
rollback;
158
select * from t2;
159
a
160
insert into t2 (a) values (1016);
161
show status where (f2(16) = 16);
162
ERROR 23000: Duplicate entry '16' for key 'a'
163
select * from t2;
164
a
165
1016
166
rollback;
167
select * from t2;
168
a
169
insert into t2 (a) values (1017);
170
show variables where (f2(17) = 17);
171
ERROR 23000: Duplicate entry '17' for key 'a'
172
select * from t2;
173
a
174
1017
175
rollback;
176
select * from t2;
177
a
178
insert into t2 (a) values (1018);
179
show charset where (f2(18) = 18);
180
ERROR 23000: Duplicate entry '18' for key 'a'
181
select * from t2;
182
a
183
1018
184
rollback;
185
select * from t2;
186
a
187
insert into t2 (a) values (1019);
188
show collation where (f2(19) = 19);
189
ERROR 23000: Duplicate entry '19' for key 'a'
190
select * from t2;
191
a
192
1019
193
rollback;
194
select * from t2;
195
a
196
# We need at least one procedure to make sure the WHERE clause is
197
# evaluated
198
create procedure dummy() begin end;
199
insert into t2 (a) values (1020);
200
show procedure status where (f2(20) = 20);
201
ERROR 23000: Duplicate entry '20' for key 'a'
202
select * from t2;
203
a
204
1020
205
rollback;
206
select * from t2;
207
a
208
drop procedure dummy;
209
insert into t2 (a) values (1021);
210
show function status where (f2(21) = 21);
211
ERROR 23000: Duplicate entry '21' for key 'a'
212
select * from t2;
213
a
214
1021
215
rollback;
216
select * from t2;
217
a
218
insert into t2 (a) values (1022);
219
prepare stmt from "insert into t1 (a) values (f2(22))";
220
execute stmt;
221
ERROR 23000: Duplicate entry '22' for key 'a'
222
select * from t2;
223
a
224
1022
225
rollback;
226
select * from t2;
227
a
228
insert into t2 (a) values (1023);
229
do (f2(23));
230
Warnings:
231
Error	1062	Duplicate entry '23' for key 'a'
232
select * from t2;
233
a
234
1023
235
rollback;
236
select * from t2;
237
a
238
create procedure bug12713_call ()
239
begin
240
insert into t2 (a) values (24);
241
insert into t2 (a) values (24);
242
end|
243
insert into t2 (a) values (1024);
244
call bug12713_call();
245
ERROR 23000: Duplicate entry '24' for key 'a'
246
select * from t2;
247
a
248
24
249
1024
250
rollback;
251
select * from t2;
252
a
253
=======================================================================
254
Testing select_to_file
255
=======================================================================
256
insert into t2 (a) values (1025);
257
select f2(25) into outfile "../tmp/dml.out" from t1;
258
ERROR 23000: Duplicate entry '25' for key 'a'
259
select * from t2;
260
a
261
1025
262
rollback;
263
select * from t2;
264
a
265
insert into t2 (a) values (1026);
266
load data infile "../std_data_ln/words.dat" into table t1 (a) set a:=f2(26);
267
ERROR 23000: Duplicate entry '26' for key 'a'
268
select * from t2;
269
a
270
1026
271
rollback;
272
select * from t2;
273
a
274
=======================================================================
275
Testing select_dumpvar
276
=======================================================================
277
insert into t2 (a) values (1027);
278
select f2(27) into @foo;
279
ERROR 23000: Duplicate entry '27' for key 'a'
280
select * from t2;
281
a
282
1027
283
rollback;
284
select * from t2;
285
a
286
=======================================================================
287
Testing Select_fetch_into_spvars 
288
=======================================================================
289
create procedure bug12713_dump_spvars ()
290
begin
291
declare foo int;
292
declare continue handler for sqlexception
293
begin
294
select "Exception trapped";
295
end;
296
select f2(28) into foo;
297
select * from t2;
298
end|
299
insert into t2 (a) values (1028);
300
call bug12713_dump_spvars ();
301
Exception trapped
302
Exception trapped
303
a
304
1028
305
rollback;
306
select * from t2;
307
a
308
=======================================================================
309
Cleanup
310
=======================================================================
311
set autocommit=default;
312
drop table t1;
313
drop table t2;
314
drop table t3;
315
drop function f2;
316
drop procedure bug12713_call;
317
drop procedure bug12713_dump_spvars;
318
#
319
# Bug#12713 Error in a stored function called from a SELECT doesn't
320
# cause ROLLBACK of statem
321
#
322
# Verify that two-phase commit is not issued for read-only
323
# transactions.
324
#
325
# Verify that two-phase commit is issued for read-write transactions,
326
# even if the change is done inside a stored function called from
327
# SELECT or SHOW statement.
328
#
329
set autocommit=0;
330
drop table if exists t1;
331
drop table if exists t2;
332
drop function if exists f1;
333
drop procedure if exists p_verify_status_increment;
334
set @binlog_format=@@global.binlog_format;
335
set sql_mode=no_engine_substitution;
336
create table t1 (a int unique);
337
create table t2 (a int) engine=myisam;
338
set sql_mode=default;
339
#
340
# An auxiliary procedure to track Handler_prepare and Handler_commit
341
# statistics.
342
#
343
create procedure
344
p_verify_status_increment(commit_inc_mixed int, prepare_inc_mixed int,
345
commit_inc_row int, prepare_inc_row int)
346
begin
347
declare commit_inc int;
348
declare prepare_inc int;
349
declare old_commit_count int default ifnull(@commit_count, 0);
350
declare old_prepare_count int default ifnull(@prepare_count, 0);
351
declare c_res int;
352
# Use a cursor to have just one access to I_S instead of 2, it is very slow
353
# and amounts for over 90% of test CPU time
354
declare c cursor for
355
select variable_value
356
from information_schema.session_status
357
where variable_name='Handler_commit' or variable_name='Handler_prepare'
358
     order by variable_name;
359
if @binlog_format = 'ROW' then
360
set commit_inc= commit_inc_row;
361
set prepare_inc= prepare_inc_row;
362
else
363
set commit_inc= commit_inc_mixed;
364
set prepare_inc= prepare_inc_mixed;
365
end if;
366
open c;
367
fetch c into c_res;
368
set @commit_count=c_res;
369
fetch c into c_res;
370
set @prepare_count=c_res;
371
close c;
372
if old_commit_count + commit_inc <> @commit_count then
373
select concat("Expected commit increment: ", commit_inc,
374
" actual: ", @commit_count - old_commit_count)
375
as 'ERROR';
376
elseif old_prepare_count + prepare_inc <> @prepare_count then
377
select concat("Expected prepare increment: ", prepare_inc,
378
" actual: ", @prepare_count - old_prepare_count)
379
as 'ERROR';
380
else
381
select '' as 'SUCCESS';
382
end if;
383
end|
384
# Reset Handler_commit and Handler_prepare counters
385
flush status;
386
#
387
# 1. Read-only statement: SELECT
388
#
389
select * from t1;
390
a
391
call p_verify_status_increment(1, 0, 1, 0);
392
SUCCESS
393
394
commit;
395
call p_verify_status_increment(1, 0, 1, 0);
396
SUCCESS
397
398
# 2. Read-write statement: INSERT, insert 1 row. 
399
#
400
insert into t1 (a) values (1);
401
call p_verify_status_increment(2, 2, 2, 2);
402
SUCCESS
403
404
commit;
405
call p_verify_status_increment(2, 2, 2, 2);
406
SUCCESS
407
408
# 3. Read-write statement: UPDATE, update 1 row. 
409
#
410
update t1 set a=2;
411
call p_verify_status_increment(2, 2, 2, 2);
412
SUCCESS
413
414
commit;
415
call p_verify_status_increment(2, 2, 2, 2);
416
SUCCESS
417
418
# 4. Read-write statement: UPDATE, update 0 rows, 1 row matches WHERE 
419
#
420
update t1 set a=2;
421
call p_verify_status_increment(2, 2, 1, 0);
422
SUCCESS
423
424
commit;
425
call p_verify_status_increment(2, 2, 1, 0);
426
SUCCESS
427
428
# 5. Read-write statement: UPDATE, update 0 rows, 0 rows match WHERE 
429
#
430
# In mixed replication mode, there is a read-only transaction
431
# in InnoDB and also the statement is written to the binary log.
432
# So we have two commits but no 2pc, since the first engine's
433
# transaction is read-only.
434
# In the row level replication mode, we only have the read-only
435
# transaction in InnoDB and nothing is written to the binary log.
436
#
437
update t1 set a=3 where a=1;
438
call p_verify_status_increment(2, 0, 1, 0);
439
SUCCESS
440
441
commit;
442
call p_verify_status_increment(2, 0, 1, 0);
443
SUCCESS
444
445
# 6. Read-write statement: DELETE, delete 0 rows. 
446
#
447
delete from t1 where a=1;
448
call p_verify_status_increment(2, 0, 1, 0);
449
SUCCESS
450
451
commit;
452
call p_verify_status_increment(2, 0, 1, 0);
453
SUCCESS
454
455
# 7. Read-write statement: DELETE, delete 1 row. 
456
#
457
delete from t1 where a=2;
458
call p_verify_status_increment(2, 2, 2, 2);
459
SUCCESS
460
461
commit;
462
call p_verify_status_increment(2, 2, 2, 2);
463
SUCCESS
464
465
# 8. Read-write statement: unqualified DELETE
466
#
467
# In statement or mixed replication mode, we call
468
# handler::ha_delete_all_rows() and write statement text
469
# to the binary log. This results in two read-write transactions.
470
# In row level replication mode, we do not call
471
# handler::ha_delete_all_rows(), but delete rows one by one.
472
# Since there are no rows, nothing is written to the binary log.
473
# Thus we have just one read-only transaction in InnoDB.
474
delete from t1;
475
call p_verify_status_increment(2, 2, 1, 0);
476
SUCCESS
477
478
commit;
479
call p_verify_status_increment(2, 2, 1, 0);
480
SUCCESS
481
482
# 9. Read-write statement: REPLACE, change 1 row. 
483
#
484
replace t1 set a=1;
485
call p_verify_status_increment(2, 2, 2, 2);
486
SUCCESS
487
488
commit;
489
call p_verify_status_increment(2, 2, 2, 2);
490
SUCCESS
491
492
# 10. Read-write statement: REPLACE, change 0 rows. 
493
#
494
replace t1 set a=1;
495
call p_verify_status_increment(2, 2, 1, 0);
496
SUCCESS
497
498
commit;
499
call p_verify_status_increment(2, 2, 1, 0);
500
SUCCESS
501
502
# 11. Read-write statement: IODKU, change 1 row. 
503
#
504
insert t1 set a=1 on duplicate key update a=a+1;
505
call p_verify_status_increment(2, 2, 2, 2);
506
SUCCESS
507
508
select * from t1;
509
a
510
2
511
call p_verify_status_increment(1, 0, 1, 0);
512
SUCCESS
513
514
commit;
515
call p_verify_status_increment(2, 2, 2, 2);
516
SUCCESS
517
518
# 12. Read-write statement: IODKU, change 0 rows. 
519
#
520
insert t1 set a=2 on duplicate key update a=2;
521
call p_verify_status_increment(1, 0, 1, 0);
522
SUCCESS
523
524
commit;
525
call p_verify_status_increment(1, 0, 1, 0);
526
SUCCESS
527
528
# 13. Read-write statement: INSERT IGNORE, change 0 rows. 
529
#
530
insert ignore t1 set a=2;
531
call p_verify_status_increment(1, 0, 1, 0);
532
SUCCESS
533
534
commit;
535
call p_verify_status_increment(1, 0, 1, 0);
536
SUCCESS
537
538
# 14. Read-write statement: INSERT IGNORE, change 1 row. 
539
#
540
insert ignore t1 set a=1;
541
call p_verify_status_increment(2, 2, 2, 2);
542
SUCCESS
543
544
commit;
545
call p_verify_status_increment(2, 2, 2, 2);
546
SUCCESS
547
548
# 15. Read-write statement: UPDATE IGNORE, change 0 rows. 
549
#
550
update ignore t1 set a=2 where a=1;
551
call p_verify_status_increment(2, 2, 1, 0);
552
SUCCESS
553
554
commit;
555
call p_verify_status_increment(2, 2, 1, 0);
556
SUCCESS
557
558
#
559
# Create a stored function that modifies a
560
# non-transactional table. Demonstrate that changes in
561
# non-transactional tables do not affect the two phase commit
562
# algorithm.
563
#
564
create function f1() returns int
565
begin
566
insert t2 set a=2;
567
return 2;
568
end|
569
call p_verify_status_increment(0, 0, 0, 0);
570
SUCCESS
571
572
# 16. A function changes non-trans-table.
573
#
574
# For row-based logging, there is an extra commit for the
575
# non-transactional changes saved in the transaction cache to
576
# the binary log. 
577
#
578
select f1();
579
f1()
580
2
581
call p_verify_status_increment(0, 0, 1, 0);
582
SUCCESS
583
584
commit;
585
call p_verify_status_increment(0, 0, 1, 0);
586
SUCCESS
587
588
# 17. Read-only statement, a function changes non-trans-table.
589
#
590
# For row-based logging, there is an extra commit for the
591
# non-transactional changes saved in the transaction cache to
592
# the binary log. 
593
#
594
select f1() from t1;
595
f1()
596
2
597
2
598
call p_verify_status_increment(1, 0, 2, 0);
599
SUCCESS
600
601
commit;
602
call p_verify_status_increment(1, 0, 2, 0);
603
SUCCESS
604
605
# 18. Read-write statement: UPDATE, change 0 (transactional) rows. 
606
#
607
select count(*) from t2;
608
count(*)
609
3
610
update t1 set a=2 where a=f1()+10;
611
select count(*) from t2;
612
count(*)
613
5
614
call p_verify_status_increment(2, 0, 2, 0);
615
SUCCESS
616
617
commit;
618
call p_verify_status_increment(2, 0, 2, 0);
619
SUCCESS
620
621
#
622
# Replace the non-transactional table with a temporary
623
# transactional table. Demonstrate that a change to a temporary
624
# transactional table does not provoke 2-phase commit, although
625
# does trigger a commit and a binlog write (in statement mode).
626
#
627
drop table t2;
628
set sql_mode=no_engine_substitution;
629
create temporary table t2 (a int);
630
call p_verify_status_increment(0, 0, 0, 0);
631
SUCCESS
632
633
set sql_mode=default;
634
# 19. A function changes temp-trans-table.
635
#
636
select f1();
637
f1()
638
2
639
# Two commits because a binary log record is written
640
call p_verify_status_increment(2, 0, 1, 0);
641
SUCCESS
642
643
commit;
644
call p_verify_status_increment(2, 0, 1, 0);
645
SUCCESS
646
647
# 20. Read-only statement, a function changes non-trans-table.
648
#
649
select f1() from t1;
650
f1()
651
2
652
2
653
# Two commits because a binary log record is written
654
call p_verify_status_increment(2, 0, 1, 0);
655
SUCCESS
656
657
commit;
658
call p_verify_status_increment(2, 0, 1, 0);
659
SUCCESS
660
661
# 21. Read-write statement: UPDATE, change 0 (transactional) rows. 
662
#
663
update t1 set a=2 where a=f1()+10;
664
call p_verify_status_increment(2, 0, 1, 0);
665
SUCCESS
666
667
commit;
668
call p_verify_status_increment(2, 0, 1, 0);
669
SUCCESS
670
671
# 22. DDL: ALTER TEMPORARY TABLE, should not cause a 2pc
672
#
673
alter table t2 add column b int default 5;
674
# A commit is done internally by ALTER. 
675
call p_verify_status_increment(2, 0, 2, 0);
676
SUCCESS
677
678
commit;
679
# There is nothing left to commit
680
call p_verify_status_increment(0, 0, 0, 0);
681
SUCCESS
682
683
# 23. DDL: RENAME TEMPORARY TABLE, does not start a transaction
684
685
# No test because of Bug#8729 "rename table fails on temporary table"
686
# 24. DDL: TRUNCATE TEMPORARY TABLE, does not start a transaction
687
688
truncate table t2;
689
call p_verify_status_increment(2, 0, 2, 0);
690
SUCCESS
691
692
commit;
693
# There is nothing left to commit
694
call p_verify_status_increment(0, 0, 0, 0);
695
SUCCESS
696
697
# 25. Read-write statement: unqualified DELETE 
698
699
delete from t2;
700
call p_verify_status_increment(2, 0, 1, 0);
701
SUCCESS
702
703
commit;
704
# There is nothing left to commit
705
call p_verify_status_increment(2, 0, 1, 0);
706
SUCCESS
707
708
# 25. DDL: DROP TEMPORARY TABLE, does not start a transaction
709
#
710
drop temporary table t2;
711
call p_verify_status_increment(0, 0, 0, 0);
712
SUCCESS
713
714
commit;
715
call p_verify_status_increment(0, 0, 0, 0);
716
SUCCESS
717
718
# 26. Verify that SET AUTOCOMMIT issues an implicit commit
719
#
720
insert t1 set a=3;
721
call p_verify_status_increment(2, 2, 2, 2);
722
SUCCESS
723
724
set autocommit=1;
725
call p_verify_status_increment(2, 2, 2, 2);
726
SUCCESS
727
728
rollback;
729
select a from t1 where a=3;
730
a
731
3
732
call p_verify_status_increment(1, 0, 1, 0);
733
SUCCESS
734
735
delete from t1 where a=3;
736
call p_verify_status_increment(2, 2, 2, 2);
737
SUCCESS
738
739
commit;
740
call p_verify_status_increment(0, 0, 0, 0);
741
SUCCESS
742
743
set autocommit=0;
744
call p_verify_status_increment(0, 0, 0, 0);
745
SUCCESS
746
747
insert t1 set a=3;
748
call p_verify_status_increment(2, 2, 2, 2);
749
SUCCESS
750
751
# Sic: not actually changing the value of autocommit
752
set autocommit=0;
753
call p_verify_status_increment(0, 0, 0, 0);
754
SUCCESS
755
756
rollback;
757
select a from t1 where a=3;
758
a
759
call p_verify_status_increment(1, 0, 1, 0);
760
SUCCESS
761
762
# 27. Savepoint management
763
#
764
insert t1 set a=3;
765
call p_verify_status_increment(2, 2, 2, 2);
766
SUCCESS
767
768
savepoint a;
769
call p_verify_status_increment(0, 0, 0, 0);
770
SUCCESS
771
772
insert t1 set a=4;
773
# Sic: a bug. Binlog did not register itself this time.
774
call p_verify_status_increment(1, 0, 1, 0);
775
SUCCESS
776
777
release savepoint a;
778
rollback;
779
call p_verify_status_increment(0, 0, 0, 0);
780
SUCCESS
781
782
select a from t1 where a=3;
783
a
784
call p_verify_status_increment(1, 0, 1, 0);
785
SUCCESS
786
787
commit;
788
call p_verify_status_increment(1, 0, 1, 0);
789
SUCCESS
790
791
# 28. Read-write statement: DO
792
#
793
create table t2 (a int);
794
call p_verify_status_increment(0, 0, 0, 0);
795
SUCCESS
796
797
do (select f1() from t1 where a=2);
798
call p_verify_status_increment(2, 2, 2, 2);
799
SUCCESS
800
801
commit;
802
call p_verify_status_increment(2, 2, 2, 2);
803
SUCCESS
804
805
# 29. Read-write statement: MULTI-DELETE
806
# 
807
delete t1, t2 from t1 join t2 on (t1.a=t2.a) where t1.a=2;
808
commit;
809
call p_verify_status_increment(4, 4, 4, 4);
810
SUCCESS
811
812
# 30. Read-write statement: INSERT-SELECT, MULTI-UPDATE, REPLACE-SELECT
813
# 
814
insert into t2 select a from t1;
815
commit;
816
replace into t2 select a from t1;
817
commit;
818
call p_verify_status_increment(8, 8, 8, 8);
819
SUCCESS
820
821
update t1, t2 set t1.a=4, t2.a=8 where t1.a=t2.a and t1.a=1;
822
commit;
823
call p_verify_status_increment(4, 4, 4, 4);
824
SUCCESS
825
826
# 31. DDL: various DDL with transactional tables
827
#
828
# Sic: no table is created.
829
create table if not exists t2 (a int) select 6 union select 7;
830
Warnings:
831
Note	1050	Table 't2' already exists
832
# Sic: first commits the statement, and then the transaction.
833
call p_verify_status_increment(4, 4, 4, 4);
834
SUCCESS
835
836
create table t3 select a from t2;
837
call p_verify_status_increment(4, 4, 4, 4);
838
SUCCESS
839
840
alter table t3 add column (b int);
841
call p_verify_status_increment(2, 0, 2, 0);
842
SUCCESS
843
844
alter table t3 rename t4;
845
call p_verify_status_increment(1, 0, 1, 0);
846
SUCCESS
847
848
rename table t4 to t3;
849
call p_verify_status_increment(1, 0, 1, 0);
850
SUCCESS
851
852
truncate table t3;
853
call p_verify_status_increment(2, 2, 2, 2);
854
SUCCESS
855
856
create view v1 as select * from t2;
857
call p_verify_status_increment(1, 0, 1, 0);
858
SUCCESS
859
860
check table t1;
861
Table	Op	Msg_type	Msg_text
862
test.t1	check	status	OK
863
call p_verify_status_increment(3, 0, 3, 0);
864
SUCCESS
865
866
# Sic: after this bug is fixed, CHECK leaves no pending transaction
867
commit;
868
call p_verify_status_increment(0, 0, 0, 0);
869
SUCCESS
870
871
check table t1, t2, t3;
872
Table	Op	Msg_type	Msg_text
873
test.t1	check	status	OK
874
test.t2	check	status	OK
875
test.t3	check	status	OK
876
call p_verify_status_increment(6, 0, 6, 0);
877
SUCCESS
878
879
commit;
880
call p_verify_status_increment(0, 0, 0, 0);
881
SUCCESS
882
883
drop view v1;
884
call p_verify_status_increment(0, 0, 0, 0);
885
SUCCESS
886
887
#
888
# Cleanup
889
#
890
drop table t1, t2, t3;
891
drop procedure p_verify_status_increment;
892
drop function f1;