summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-09-26 10:28:00 +0200
committerSergei Golubchik <serg@mariadb.org>2017-10-03 20:23:33 +0200
commit26ff92f7ac2dc373769b8053e936e4593a2ee302 (patch)
treed64ef7d8b9f9de77795a89609d30dd0e9217fc0e /mysql-test
parentb6a5be9eaa715c190d05d370998f6ef4f72acaab (diff)
downloadmariadb-git-26ff92f7ac2dc373769b8053e936e4593a2ee302.tar.gz
MDEV-13911 Support ORDER BY and LIMIT in multi-table update
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/multi_update.result27
-rw-r--r--mysql-test/t/multi_update.test14
2 files changed, 41 insertions, 0 deletions
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index 2a0a6677c6f..339dc35e9c4 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -942,3 +942,30 @@ deallocate prepare stmt1;
drop view v3,v2,v1;
drop table t1,t2,t3;
end of 5.5 tests
+create table t1 (c1 int, c3 int);
+insert t1(c3) values (1), (2), (3), (4), (5), (6), (7), (8);
+create table t2 select * from t1;
+update t1, t2 set t1.c1=t2.c3 where t1.c3=t2.c3 order by t1.c3 limit 3;
+select * from t1;
+c1 c3
+1 1
+2 2
+3 3
+NULL 4
+NULL 5
+NULL 6
+NULL 7
+NULL 8
+update t1 set c1=NULL;
+update t1, t2 set t1.c1=t2.c3 where t1.c3=t2.c3 order by t1.c3 desc limit 2;
+select * from t1;
+c1 c3
+NULL 1
+NULL 2
+NULL 3
+NULL 4
+NULL 5
+NULL 6
+7 7
+8 8
+drop table t1, t2;
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
index 0a7e6b221eb..bd5d7a9768c 100644
--- a/mysql-test/t/multi_update.test
+++ b/mysql-test/t/multi_update.test
@@ -901,3 +901,17 @@ deallocate prepare stmt1;
drop view v3,v2,v1;
drop table t1,t2,t3;
--echo end of 5.5 tests
+
+#
+# MDEV-13911 Support ORDER BY and LIMIT in multi-table update
+#
+
+create table t1 (c1 int, c3 int);
+insert t1(c3) values (1), (2), (3), (4), (5), (6), (7), (8);
+create table t2 select * from t1;
+update t1, t2 set t1.c1=t2.c3 where t1.c3=t2.c3 order by t1.c3 limit 3;
+select * from t1;
+update t1 set c1=NULL;
+update t1, t2 set t1.c1=t2.c3 where t1.c3=t2.c3 order by t1.c3 desc limit 2;
+select * from t1;
+drop table t1, t2;