--- a/mysql-test/t/view.test Mon Apr 16 11:56:58 2007 +++ b/mysql-test/t/view.test Mon Apr 16 12:00:55 2007 @@ -3284,6 +3284,20 @@ select * from v4 UNION select a from v4 order by a limit 2; select * from v4 UNION select a from v4 order by 1 desc limit 2; +# tests with braces +select a from t2 UNION (select * from v1 order by 1); +select a from t2 UNION (select * from v1 limit 1); +select a from t2 UNION (select * from v1 order by 1 limit 1); +select a from t2 UNION (select * from v1 order by a desc limit 1); + +select a from v1 UNION ALL (select * from v1 order by 1); +select a from v1 UNION ALL (select * from v1 limit 1); +select a from v1 UNION ALL (select * from v1 order by 1 limit 1); +select a from v1 UNION ALL (select * from v1 order by a desc limit 1); + +select a from v3 UNION ALL (select * from v1 order by 1) order by a; +select a from v3 UNION ALL (select * from v1 limit 1) order by a; +select a from v3 UNION ALL (select * from v1 order by a desc limit 1) order by a; drop table t1,t2,t3; --- a/mysql-test/r/view.result Mon Apr 16 11:57:08 2007 +++ b/mysql-test/r/view.result Mon Apr 16 12:01:22 2007 @@ -3557,5 +3557,76 @@ a 30 20 +select a from t2 UNION (select * from v1 order by 1); +a +5 +50 +10 +20 +30 +select a from t2 UNION (select * from v1 limit 1); +a +5 +50 +10 +select a from t2 UNION (select * from v1 order by 1 limit 1); +a +5 +50 +10 +select a from t2 UNION (select * from v1 order by a desc limit 1); +a +5 +50 +30 +select a from v1 UNION ALL (select * from v1 order by 1); +a +10 +20 +20 +30 +10 +20 +20 +30 +select a from v1 UNION ALL (select * from v1 limit 1); +a +10 +20 +20 +30 +10 +select a from v1 UNION ALL (select * from v1 order by 1 limit 1); +a +10 +20 +20 +30 +10 +select a from v1 UNION ALL (select * from v1 order by a desc limit 1); +a +10 +20 +20 +30 +30 +select a from v3 UNION ALL (select * from v1 order by 1) order by a; +a +10 +10 +20 +20 +20 +30 +select a from v3 UNION ALL (select * from v1 limit 1) order by a; +a +10 +10 +20 +select a from v3 UNION ALL (select * from v1 order by a desc limit 1) order by a; +a +10 +20 +30 drop table t1,t2,t3; drop view v1,v2,v3,v4;