1
# Tests of various SAVEPOINT functionality
3
# Test for Bug #534806 - SAVEPOINT without active transaction
4
# triggers assert in InnoDB handler
6
--echo Start Test of Bug 534806
9
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY);
11
UPDATE t1 SET id = 2 WHERE id != 2 LIMIT 0;
14
--echo End Test of Bug 534806
18
# Let's test the non-edge case for SAVEPOINTS:
20
# Typical usage pattern of starting a transaction, doing
21
# some work, savepointing, do more work, savepointing, etc
22
# and committing without any rollbacks or savepoint releases.
24
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY);
26
INSERT INTO t1 VALUES (1);
28
INSERT INTO t1 VALUES (2);
30
INSERT INTO t1 VALUES (3);
33
# t1 should now have 1,2,3 in it.
36
# We now test another typical usage pattern, similar to above,
37
# but we issue a ROLLBACK at the end instead of a COMMIT. All
38
# work done in all savepoints should be rolled back.
41
INSERT INTO t1 VALUES (4);
43
INSERT INTO t1 VALUES (5);
45
INSERT INTO t1 VALUES (6);
48
# t1 should still have 1,2,3 in it.
51
# We now test the final typical usage pattern, where we
52
# ROLLBACK work to a specific SAVEPOINT and then COMMIT.
55
INSERT INTO t1 VALUES (4);
57
INSERT INTO t1 VALUES (5);
59
INSERT INTO t1 VALUES (6);
60
ROLLBACK TO SAVEPOINT A;
63
# t1 should have 1,2,3,4 in it.
69
# Test for Bug #542299
71
# segfault on ROLLBACK TO SAVEPOINT A - during randgen
73
--echo Start Test of Bug 542299
75
CREATE TABLE t1 (a int,id integer auto_increment,b int,/*Indices*/key (a ),primary key (id)) ENGINE=innodb;
76
INSERT INTO t1 VALUES (100, NULL, 100) , (100, NULL, 100) , (100, NULL, 100) , (100, NULL, 100) , (100, NULL, 100) , (100, NULL, 100) , (100, NULL, 100) , (100, NULL, 100);
78
DELETE FROM t1 WHERE 1 = 1 LIMIT 1;
79
COMMIT; /* OR ROLLBACK... */
81
INSERT INTO t1 ( a, b ) VALUES ( 1 , 9 );
82
ROLLBACK TO SAVEPOINT A;
84
--echo End Test of Bug 542299