1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-02 09:41:40 +03:00

MDEV-13911 Support ORDER BY and LIMIT in multi-table update

This commit is contained in:
Sergei Golubchik
2017-09-26 10:28:00 +02:00
parent b6a5be9eaa
commit 26ff92f7ac
5 changed files with 51 additions and 15 deletions

View File

@@ -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;