summaryrefslogtreecommitdiff
path: root/mysql-test/t/union.test
diff options
context:
space:
mode:
authorunknown <mhansson/martin@linux-st28.site>2007-12-15 12:07:33 +0100
committerunknown <mhansson/martin@linux-st28.site>2007-12-15 12:07:33 +0100
commit30b17b997fa7a096b2644a3260cf1106e69f1ccc (patch)
treeea4a2f8d8db958da25a0c5f8c16d98b39096cdd0 /mysql-test/t/union.test
parentd8babe1ae29065af5fa1c11f16e8db52c280e5ca (diff)
parent93e3057ba574672c2f0bb1b0958221c0d7efc553 (diff)
downloadmariadb-git-30b17b997fa7a096b2644a3260cf1106e69f1ccc.tar.gz
Merge mhansson@bk-internal:/home/bk/mysql-5.0-opt
into linux-st28.site:/home/martin/mysql/src/bug32858/my50-bug32858-push sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_yacc.yy: Auto merged mysql-test/r/union.result: Bug#32858: Manual merge mysql-test/t/union.test: Bug#32858: Manual merge
Diffstat (limited to 'mysql-test/t/union.test')
-rw-r--r--mysql-test/t/union.test57
1 files changed, 57 insertions, 0 deletions
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index 0277b01e21a..3bf8e204333 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -921,4 +921,61 @@ SELECT 1,1;
DROP TABLE t1,t2;
+# Bug#32858: Erro: "Incorrect usage of UNION and INTO" does not take subselects
+# into account
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1);
+
+SELECT a INTO @v FROM (
+ SELECT a FROM t1
+ UNION
+ SELECT a FROM t1
+) alias;
+
+SELECT a INTO OUTFILE 'union.out.file' FROM (
+ SELECT a FROM t1
+ UNION
+ SELECT a FROM t1 WHERE 0
+) alias;
+
+SELECT a INTO DUMPFILE 'union.out.file2' FROM (
+ SELECT a FROM t1
+ UNION
+ SELECT a FROM t1 WHERE 0
+) alias;
+
+#
+# INTO will not be allowed in subqueries in version 5.1 and above.
+#
+SELECT a FROM (
+ SELECT a FROM t1
+ UNION
+ SELECT a INTO @v FROM t1
+) alias;
+
+SELECT a FROM (
+ SELECT a FROM t1
+ UNION
+ SELECT a INTO OUTFILE 'union.out.file3' FROM t1
+) alias;
+
+SELECT a FROM (
+ SELECT a FROM t1
+ UNION
+ SELECT a INTO DUMPFILE 'union.out.file4' FROM t1
+) alias;
+
+SELECT a FROM t1 UNION SELECT a INTO @v FROM t1;
+SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file5' FROM t1;
+SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file6' FROM t1;
+--error ER_WRONG_USAGE
+SELECT a INTO @v FROM t1 UNION SELECT a FROM t1;
+--error ER_WRONG_USAGE
+SELECT a INTO OUTFILE 'union.out.file7' FROM t1 UNION SELECT a FROM t1;
+--error ER_WRONG_USAGE
+SELECT a INTO DUMPFILE 'union.out.file8' FROM t1 UNION SELECT a FROM t1;
+
+DROP TABLE t1;
+
--echo End of 5.0 tests