mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / mysql-test / suite / ndb / t / ndb_update.test
blobab0fbee171e1eef6b96c9e24d1cf9706ff583a7a
1 -- source include/have_ndb.inc
2 -- source include/not_embedded.inc
4 --disable_warnings
5 DROP TABLE IF EXISTS t1;
6 DROP TABLE IF EXISTS t2;
7 DROP TABLE IF EXISTS t3;
8 --enable_warnings
11 # Basic test of UPDATE in NDB 
15 # Create a normal table with primary key
17 CREATE TABLE t1 (
18   pk1 INT NOT NULL PRIMARY KEY,
19   b INT NOT NULL,
20   c INT NOT NULL UNIQUE
21 ) ENGINE=ndbcluster;
23 INSERT INTO t1 VALUES (0, 1, 0),(1,2,1),(2,3,2);
24 UPDATE t1 set b = c;
25 select * from t1 order by pk1;
26 UPDATE t1 set pk1 = 4 where pk1 = 1;
27 select * from t1 order by pk1;
28 --error ER_DUP_ENTRY
29 UPDATE t1 set pk1 = 4 where pk1 = 2;
30 UPDATE IGNORE t1 set pk1 = 4 where pk1 = 2;
31 select * from t1 order by pk1;
32 --error ER_DUP_ENTRY
33 UPDATE t1 set pk1 = 1, c = 2 where pk1 = 4;
34 UPDATE IGNORE t1 set pk1 = 1, c = 2 where pk1 = 4;
35 select * from t1 order by pk1;
36 UPDATE t1 set pk1 = pk1 + 10;
37 select * from t1 order by pk1;
38 # bug#25817
39 create unique index ib on t1(b);
40 update t1 set c = 4 where pk1 = 12;
41 update ignore t1 set b = 55 where pk1 = 14;
42 select * from t1 order by pk1;
44 --disable_warnings
45 DROP TABLE IF EXISTS t1;
46 --enable_warnings
48 # End of 4.1 tests
51 # Bug#28158: table->read_set is set incorrectly,
52 #            causing wrong error message in Falcon
54 CREATE TABLE t1 (a int, b int, KEY (a, b)) ENGINE=ndbcluster;
55 CREATE TABLE t2 (a int, b int, UNIQUE KEY (a, b)) ENGINE=ndbcluster;
56 CREATE TABLE t3 (a int, b int, PRIMARY KEY (a, b)) ENGINE=ndbcluster;
58 INSERT INTO t1 VALUES (1, 2);
59 INSERT INTO t1 VALUES (2, 2);
61 INSERT INTO t2 VALUES (1, 2);
62 INSERT INTO t2 VALUES (2, 2);
64 INSERT INTO t3 VALUES (1, 2);
65 INSERT INTO t3 VALUES (2, 2);
67 UPDATE t1 SET a = 1;
68 UPDATE t1 SET a = 1 ORDER BY a;
70 --error ER_DUP_ENTRY
71 UPDATE t2 SET a = 1;
72 --error ER_DUP_ENTRY
73 UPDATE t2 SET a = 1 ORDER BY a;
75 --error ER_DUP_ENTRY
76 UPDATE t3 SET a = 1;
77 --error ER_DUP_ENTRY
78 UPDATE t3 SET a = 1 ORDER BY a;
80 SELECT count(*) FROM t1;
81 SELECT count(*) FROM t2;
82 SELECT count(*) FROM t3;
83 SELECT * FROM t1 ORDER by a;
84 SELECT * FROM t2 ORDER by a;
85 SELECT * FROM t3 ORDER by a;
87 --disable_warnings
88 DROP TABLE IF EXISTS t1;
89 DROP TABLE IF EXISTS t2;
90 DROP TABLE IF EXISTS t3;
91 --enable_warnings
93 --echo End of 5.1 tests