summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <mskold@mysql.com>2005-04-19 12:51:20 +0200
committerunknown <mskold@mysql.com>2005-04-19 12:51:20 +0200
commit432bc644c4af6c67f356354ad390fc1250541797 (patch)
tree2024c1376fc8fa5e11632eed866af792adf3e357 /mysql-test
parent92a00143d7460c964523494e573508c151b9cba4 (diff)
parentfd9d58c413bf9830d9ee23cfdc54784ead768d25 (diff)
downloadmariadb-git-432bc644c4af6c67f356354ad390fc1250541797.tar.gz
Merge mskold@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/usr/local/home/marty/MySQL/mysql-4.1
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/ndb_update.result30
-rw-r--r--mysql-test/t/ndb_update.test15
2 files changed, 38 insertions, 7 deletions
diff --git a/mysql-test/r/ndb_update.result b/mysql-test/r/ndb_update.result
index 5df5c861cfb..c2247564e65 100644
--- a/mysql-test/r/ndb_update.result
+++ b/mysql-test/r/ndb_update.result
@@ -2,12 +2,32 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
b INT NOT NULL,
-c INT NOT NULL
+c INT NOT NULL UNIQUE
) ENGINE=ndbcluster;
-INSERT INTO t1 VALUES (0, 0, 1),(1,1,2),(2,2,3);
+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 1 1
-1 2 2
-2 3 3
+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;
diff --git a/mysql-test/t/ndb_update.test b/mysql-test/t/ndb_update.test
index 3b0e84e2344..fc489ec4697 100644
--- a/mysql-test/t/ndb_update.test
+++ b/mysql-test/t/ndb_update.test
@@ -14,9 +14,20 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
b INT NOT NULL,
- c INT NOT NULL
+ c INT NOT NULL UNIQUE
) ENGINE=ndbcluster;
-INSERT INTO t1 VALUES (0, 0, 1),(1,1,2),(2,2,3);
+INSERT INTO t1 VALUES (0, 1, 0),(1,2,1),(2,3,2);
UPDATE t1 set b = c;
select * from t1 order by pk1;
+UPDATE t1 set pk1 = 4 where pk1 = 1;
+select * from t1 order by pk1;
+-- error 1062
+UPDATE t1 set pk1 = 1, c = 2 where pk1 = 4;
+select * from t1 order by pk1;
+UPDATE t1 set pk1 = pk1 + 10;
+select * from t1 order by pk1;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings