1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
--source include/have_innodb.inc
--echo #
--echo # BUG#57373: Multi update+InnoDB reports ER_KEY_NOT_FOUND if a
--echo # table is updated twice
--echo #
# Results differ between storage engines.
# See multi_update.test for the MyISAM variant of this test
CREATE TABLE t1(
pk INT,
a INT,
b INT,
PRIMARY KEY (pk)
) ENGINE=InnoDB;
INSERT INTO t1 VALUES (0,0,0);
--error ER_MULTI_UPDATE_KEY_CONFLICT
UPDATE t1 AS A, t1 AS B SET A.pk = 1, B.a = 2;
SELECT * FROM t1;
CREATE VIEW v1 AS SELECT * FROM t1;
--error ER_MULTI_UPDATE_KEY_CONFLICT
UPDATE v1 AS A, t1 AS B SET A.pk = 1, B.a = 2;
SELECT * FROM t1;
UPDATE t1 AS A, t1 AS B SET A.a = 1, B.b = 2;
--echo # Should be (0,1,2)
SELECT * FROM t1;
DROP VIEW v1;
DROP TABLE t1;
--echo #
--echo # BUG#11882110: UPDATE REPORTS ER_KEY_NOT_FOUND IF TABLE IS
--echo # UPDATED TWICE
--echo #
# Results differ between storage engines.
# See multi_update.test for the MyISAM variant of this test
CREATE TABLE t1 (
col_int_key int,
pk int,
col_int int,
key(col_int_key),
primary key (pk)
) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,2,3);
--echo
CREATE TABLE t2 (
col_int_key int,
pk_1 int,
pk_2 int,
col_int int,
key(col_int_key),
primary key (pk_1,pk_2)
) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1,2,3,4);
--echo
--error ER_MULTI_UPDATE_KEY_CONFLICT
UPDATE t1 AS A NATURAL JOIN t1 B SET A.pk=5,B.pk=7;
--echo
SELECT * FROM t1;
--echo
--error ER_MULTI_UPDATE_KEY_CONFLICT
UPDATE t2 AS A NATURAL JOIN t2 B SET A.pk_1=5,B.pk_1=7;
--echo
--error ER_MULTI_UPDATE_KEY_CONFLICT
UPDATE t2 AS A NATURAL JOIN t2 B SET A.pk_2=10,B.pk_2=11;
--echo
SELECT * FROM t2;
DROP TABLE t1,t2;
|