summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorevgen@moonbone.local <>2007-02-07 00:46:03 +0300
committerevgen@moonbone.local <>2007-02-07 00:46:03 +0300
commit968369906efe7fa628caeb0e15731770161e7e7c (patch)
tree56c0e739bcc59645b6b36a4c468a1034d31858df /mysql-test
parent5092f7ab269c75273c791201eb0cc803a2f456ee (diff)
downloadmariadb-git-968369906efe7fa628caeb0e15731770161e7e7c.tar.gz
Bug#19978: INSERT .. ON DUPLICATE erroneously reports some records were
updated. INSERT ... ON DUPLICATE KEY UPDATE reports that a record was updated when the duplicate key occurs even if the record wasn't actually changed because the update values are the same as those in the record. Now the compare_record() function is used to check whether the record was changed and the update of a record reported only if the record differs from the original one.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/insert_select.result12
-rw-r--r--mysql-test/t/insert_select.test13
2 files changed, 25 insertions, 0 deletions
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index 1453d25ac75..82cc1b036a7 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -705,3 +705,15 @@ use bug21774_1;
INSERT INTO bug21774_2.t1 SELECT t1.* FROM t1;
DROP DATABASE bug21774_1;
DROP DATABASE bug21774_2;
+USE test;
+create table t1(f1 int primary key, f2 int);
+insert into t1 values (1,1);
+affected rows: 1
+insert into t1 values (1,1) on duplicate key update f2=1;
+affected rows: 0
+insert into t1 values (1,1) on duplicate key update f2=2;
+affected rows: 2
+select * from t1;
+f1 f2
+1 2
+drop table t1;
diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test
index 404d67390ab..6302d5f1dae 100644
--- a/mysql-test/t/insert_select.test
+++ b/mysql-test/t/insert_select.test
@@ -265,4 +265,17 @@ INSERT INTO bug21774_2.t1 SELECT t1.* FROM t1;
DROP DATABASE bug21774_1;
DROP DATABASE bug21774_2;
+USE test;
+#
+# Bug#19978: INSERT .. ON DUPLICATE erroneously reports some records were
+# updated.
+#
+create table t1(f1 int primary key, f2 int);
+--enable_info
+insert into t1 values (1,1);
+insert into t1 values (1,1) on duplicate key update f2=1;
+insert into t1 values (1,1) on duplicate key update f2=2;
+--disable_info
+select * from t1;
+drop table t1;