summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <Sinisa@sinisa.nasamreza.org>2002-12-24 13:58:07 +0200
committerunknown <Sinisa@sinisa.nasamreza.org>2002-12-24 13:58:07 +0200
commit7a74837e00be97bfaaf2940f06c636da7eed73a8 (patch)
tree47e3ffaa6aba38ec5904fb7bcd002fa92b377664 /mysql-test
parent9528812119fbaaa87ef6de0e2d03910e09ff1ea7 (diff)
downloadmariadb-git-7a74837e00be97bfaaf2940f06c636da7eed73a8.tar.gz
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
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/multi_update.result15
-rw-r--r--mysql-test/r/subselect.result6
-rw-r--r--mysql-test/t/multi_update.test6
-rw-r--r--mysql-test/t/subselect.test6
4 files changed, 27 insertions, 6 deletions
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index 8cf035343b1..f19323e1ffe 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -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;
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 493768ece4a..c928538ed9c 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -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
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
index ff456b710c1..4e0622d14bb 100644
--- a/mysql-test/t/multi_update.test
+++ b/mysql-test/t/multi_update.test
@@ -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;
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 0527d6a2001..ccf66ae23a9 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -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