summaryrefslogtreecommitdiff
path: root/mysql-test/t/insert_select.test
diff options
context:
space:
mode:
authormonty@mishka.local <>2005-06-27 16:46:41 +0300
committermonty@mishka.local <>2005-06-27 16:46:41 +0300
commit83f90e060e464292e27ecdf4afd143b914b24c27 (patch)
treec9f8f871238233e8d65c87579ff7e4d3aae6b221 /mysql-test/t/insert_select.test
parentd0700b819ea863da2d51cd56bcb50e752df3a24f (diff)
downloadmariadb-git-83f90e060e464292e27ecdf4afd143b914b24c27.tar.gz
Better bug fix for:
#9728 'Decreased functionality in "on duplicate key update #8147 'a column proclaimed ambigous in INSERT ... SELECT .. ON DUPLICATE' This ensures fields are uniquely qualified and also that one can't update other tables in the ON DUPLICATE KEY UPDATE part
Diffstat (limited to 'mysql-test/t/insert_select.test')
-rw-r--r--mysql-test/t/insert_select.test22
1 files changed, 18 insertions, 4 deletions
diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test
index 7402940fa52..67799873b73 100644
--- a/mysql-test/t/insert_select.test
+++ b/mysql-test/t/insert_select.test
@@ -3,7 +3,7 @@
#
--disable_warnings
-drop table if exists t1,t2;
+drop table if exists t1,t2,t3;
--enable_warnings
create table t1 (bandID MEDIUMINT UNSIGNED NOT NULL PRIMARY KEY, payoutID SMALLINT UNSIGNED NOT NULL);
@@ -182,10 +182,24 @@ drop table t1, t2;
#
create table t1 (a int unique);
create table t2 (a int, b int);
+create table t3 (c int, d int);
insert into t1 values (1),(2);
insert into t2 values (1,2);
+insert into t3 values (1,6),(3,7);
select * from t1;
-insert into t1 select t2.a from t2 on duplicate key update a= a + t2.b;
+insert into t1 select a from t2 on duplicate key update a= t1.a + t2.b;
select * from t1;
-drop table t1;
-drop table t2;
+insert into t1 select a+1 from t2 on duplicate key update t1.a= t1.a + t2.b+1;
+select * from t1;
+insert into t1 select t3.c from t3 on duplicate key update a= a + t3.d;
+select * from t1;
+insert into t1 select t2.a from t2 group by t2.a on duplicate key update a= a + 10;
+
+#Some error cases
+--error 1052
+insert into t1 select t2.a from t2 on duplicate key update a= a + t2.b;
+--error 1109
+insert into t1 select t2.a from t2 on duplicate key update t2.a= a + t2.b;
+--error 1109
+insert into t1 select t2.a from t2 group by t2.a on duplicate key update a= t1.a + t2.b;
+drop table t1,t2,t3;