summaryrefslogtreecommitdiff
path: root/mysql-test/t/insert_update.test
diff options
context:
space:
mode:
authorunknown <serg@serg.mysql.com>2002-12-02 20:38:00 +0100
committerunknown <serg@serg.mysql.com>2002-12-02 20:38:00 +0100
commit0029b4e7941c48ab0033491e7bd278abff09951b (patch)
treedef5561a631f2faec95f4e40d65e292ef8067f19 /mysql-test/t/insert_update.test
parent0859f671bd6a5a4c4c89e484a97f2bfcb099e8d3 (diff)
downloadmariadb-git-0029b4e7941c48ab0033491e7bd278abff09951b.tar.gz
INSERT ... ON DUPLICATE KEY UPDATE ...
Diffstat (limited to 'mysql-test/t/insert_update.test')
-rw-r--r--mysql-test/t/insert_update.test19
1 files changed, 19 insertions, 0 deletions
diff --git a/mysql-test/t/insert_update.test b/mysql-test/t/insert_update.test
new file mode 100644
index 00000000000..1c0cfff8167
--- /dev/null
+++ b/mysql-test/t/insert_update.test
@@ -0,0 +1,19 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT, b INT, c INT, UNIQUE (A), UNIQUE(B));
+INSERT t1 VALUES (1,2,10), (3,4,20);
+INSERT t1 VALUES (5,6,30) ON DUPLICATE KEY UPDATE SET c=c+100;
+SELECT * FROM t1;
+INSERT t1 VALUES (5,7,40) ON DUPLICATE KEY UPDATE SET c=c+100;
+SELECT * FROM t1;
+INSERT t1 VALUES (8,4,50) ON DUPLICATE KEY UPDATE SET c=c+1000;
+SELECT * FROM t1;
+INSERT t1 VALUES (1,4,60) ON DUPLICATE KEY UPDATE SET c=c+10000;
+SELECT * FROM t1;
+-- error 1062
+INSERT t1 VALUES (1,9,70) ON DUPLICATE KEY UPDATE SET c=c+100000, b=4;
+SELECT * FROM t1;
+TRUNCATE TABLE t1;
+INSERT t1 VALUES (1,2,10), (3,4,20);
+INSERT t1 VALUES (5,6,30), (7,4,40), (8,9,60) ON DUPLICATE KEY UPDATE SET c=c+100;
+SELECT * FROM t1;
+DROP TABLE t1;