| 1 |
create table t1 ( |
| 2 |
rowid int, |
| 3 |
f1 int, |
| 4 |
f2 int, |
| 5 |
key i1 (f1, f2), |
| 6 |
key i2 (f2)) engine=innodb; |
| 7 |
show create table t1; |
| 8 |
Table Create Table |
| 9 |
t1 CREATE TABLE `t1` ( |
| 10 |
`rowid` int DEFAULT NULL, |
| 11 |
`f1` int DEFAULT NULL, |
| 12 |
`f2` int DEFAULT NULL, |
| 13 |
KEY `i1` (`f1`,`f2`), |
| 14 |
KEY `i2` (`f2`) |
| 15 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
| 16 |
insert into `t1` (rowid, f1, f2) values (1, 1, 10), (2, 1, NULL); |
| 17 |
start transaction with consistent snapshot; |
| 18 |
start transaction; |
| 19 |
update t1 set f2 = 4 where f1 = 1 and f2 is null; |
| 20 |
(b) Number of rows updated: |
| 21 |
select row_count(); |
| 22 |
row_count() |
| 23 |
1 |
| 24 |
insert into t1 values (3, 1, null); |
| 25 |
(b) After update and insert query. |
| 26 |
select rowid, f1, f2 from t1; |
| 27 |
rowid f1 f2 |
| 28 |
1 1 10 |
| 29 |
2 1 4 |
| 30 |
3 1 NULL |
| 31 |
commit; |
| 32 |
(a) Before the update statement is executed. |
| 33 |
select rowid, f1, f2 from t1; |
| 34 |
rowid f1 f2 |
| 35 |
1 1 10 |
| 36 |
2 1 NULL |
| 37 |
SET SESSION debug="+d,bug14007649"; |
| 38 |
update t1 set f2 = 6 where f1 = 1 and f2 is null; |
| 39 |
(a) Number of rows updated: |
| 40 |
select row_count(); |
| 41 |
row_count() |
| 42 |
1 |
| 43 |
(a) After the update statement is executed. |
| 44 |
select rowid, f1, f2 from t1; |
| 45 |
rowid f1 f2 |
| 46 |
1 1 10 |
| 47 |
2 1 NULL |
| 48 |
3 1 6 |
| 49 |
commit; |
| 50 |
"The trx with consistent snapshot ended." |
| 51 |
select rowid, f1, f2 from t1; |
| 52 |
rowid f1 f2 |
| 53 |
1 1 10 |
| 54 |
2 1 4 |
| 55 |
3 1 6 |
| 56 |
drop table t1; |