mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Many fixes.
I still have to make a test case for : UPDATE from sub-select with derived table mysql-test/r/multi_update.result: Test for found rows in multi-table update mysql-test/r/subselect.result: Fix for new syntax for UNION's mysql-test/t/multi_update.test: Test for found rows in multi-table update mysql-test/t/subselect.test: Fix for new syntax for UNION's sql/sql_cache.cc: Fix for a bug that involved derived table in sub-select in UPDATE or DELETE statement sql/sql_derived.cc: Fix for a bug that involved derived table in sub-select in UPDATE or DELETE statement sql/sql_parse.cc: Fix for a bug that involved derived table in sub-select in UPDATE or DELETE statement sql/sql_show.cc: Fix for th eshow of replication status sql/sql_yacc.yy: Three fixes. One for not allowing mixing of braces and non-braces in UNION's Second one for table aliases in multi-table deletes / updates Third one for using derived tables within sub-selects for UPDATE / DELETE commands
This commit is contained in:
@ -235,4 +235,19 @@ select * from t2;
|
||||
n d
|
||||
1 30
|
||||
1 30
|
||||
UPDATE t1 a ,t2 b SET t1.d=t2.d,t2.d=30 WHERE a.n=b.n;
|
||||
select * from t1;
|
||||
n d
|
||||
1 30
|
||||
3 2
|
||||
select * from t2;
|
||||
n d
|
||||
1 30
|
||||
1 30
|
||||
DELETE t1, t2 FROM t1 a,t2 b where a.n=b.n;
|
||||
select * from t1;
|
||||
n d
|
||||
3 2
|
||||
select * from t2;
|
||||
n d
|
||||
drop table t1,t2;
|
||||
|
@ -86,20 +86,20 @@ select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1);
|
||||
a b
|
||||
1 7
|
||||
2 7
|
||||
select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)
|
||||
(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1))
|
||||
union (select * from t4 order by a limit 2) limit 3;
|
||||
a b
|
||||
1 7
|
||||
2 7
|
||||
3 8
|
||||
select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)
|
||||
(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1))
|
||||
union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a);
|
||||
a b
|
||||
1 7
|
||||
2 7
|
||||
3 8
|
||||
4 8
|
||||
explain select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)
|
||||
explain (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1))
|
||||
union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
|
||||
|
@ -213,4 +213,10 @@ insert into t2 values(1,10),(1,20);
|
||||
UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
UPDATE t1 a ,t2 b SET t1.d=t2.d,t2.d=30 WHERE a.n=b.n;
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
DELETE t1, t2 FROM t1 a,t2 b where a.n=b.n;
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
drop table t1,t2;
|
||||
|
@ -44,11 +44,11 @@ select (select a from t3), a from t2;
|
||||
select * from t2 where t2.a=(select a from t1);
|
||||
insert into t3 values (6),(7),(3);
|
||||
select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1);
|
||||
select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)
|
||||
(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1))
|
||||
union (select * from t4 order by a limit 2) limit 3;
|
||||
select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)
|
||||
(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1))
|
||||
union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a);
|
||||
explain select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)
|
||||
explain (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1))
|
||||
union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a);
|
||||
select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
|
||||
select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from
|
||||
|
Reference in New Issue
Block a user