mariadb/mysql-test/r/ndb_update.result
svoj@mysql.com/april.(none) b141a7c1b9 BUG#21381 - Engine not notified about multi-table UPDATE IGNORE
Though this is not storage engine specific problem, I was able to
repeat this problem with BDB and NDB engines only. That was the
reason to add a test case into ndb_update.test. As a result
different bad things could happen.

BDB has removed duplicate rows which is not expected.
NDB returns an error.

For multi table update notify storage engine about UPDATE IGNORE
as it is done in single table UPDATE.
2006-10-05 18:23:53 +05:00

41 lines
794 B
Text

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
b INT NOT NULL,
c INT NOT NULL UNIQUE
) ENGINE=ndbcluster;
INSERT INTO t1 VALUES (0, 1, 0),(1,2,1),(2,3,2);
UPDATE t1 set b = c;
select * from t1 order by pk1;
pk1 b c
0 0 0
1 1 1
2 2 2
UPDATE t1 set pk1 = 4 where pk1 = 1;
select * from t1 order by pk1;
pk1 b c
0 0 0
2 2 2
4 1 1
UPDATE t1 set pk1 = 1, c = 2 where pk1 = 4;
ERROR 23000: Duplicate entry '1' for key 1
select * from t1 order by pk1;
pk1 b c
0 0 0
2 2 2
4 1 1
UPDATE t1 set pk1 = pk1 + 10;
select * from t1 order by pk1;
pk1 b c
10 0 0
12 2 2
14 1 1
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT NOT NULL, UNIQUE(a)) ENGINE=ndbcluster;
INSERT INTO t1 VALUES(1),(2);
UPDATE IGNORE t1, t1 AS t1a SET t1.a=3;
SELECT a FROM t1 ORDER BY a;
a
1
3
DROP TABLE t1;