ndb_update.result 802 Bytes
Newer Older
1 2 3 4
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
b INT NOT NULL,
unknown's avatar
unknown committed
5
c INT NOT NULL UNIQUE
6
) ENGINE=ndbcluster;
unknown's avatar
unknown committed
7
INSERT INTO t1 VALUES (0, 1, 0),(1,2,1),(2,3,2);
8 9 10
UPDATE t1 set b = c;
select * from t1 order by pk1;
pk1	b	c
unknown's avatar
unknown committed
11 12 13 14 15 16 17 18 19
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
20 21 22 23 24 25 26 27
UPDATE t1 set pk1 = 4 where pk1 = 2;
ERROR 23000: Duplicate entry '4' for key 1
UPDATE IGNORE t1 set pk1 = 4 where pk1 = 2;
select * from t1 order by pk1;
pk1	b	c
0	0	0
2	2	2
4	1	1
unknown's avatar
unknown committed
28
UPDATE t1 set pk1 = 1, c = 2 where pk1 = 4;
29
ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
unknown's avatar
unknown committed
30 31 32 33 34 35 36 37 38 39 40 41
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;