summaryrefslogtreecommitdiff
path: root/mysql-test/r/union.result
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@magare.gmz>2008-05-13 18:10:46 +0300
committerunknown <gkodinov/kgeorge@magare.gmz>2008-05-13 18:10:46 +0300
commit2cc7999b123187005d84a3dd6a78c83605be420a (patch)
tree1c3410d566b7bf8c2910ab4642c23200305af835 /mysql-test/r/union.result
parentb6fdf4d9568fd07a60557604a732968ee7d584e5 (diff)
downloadmariadb-git-2cc7999b123187005d84a3dd6a78c83605be420a.tar.gz
Bug #32858: Erro: "Incorrect usage of UNION and INTO" does not take
subselects into account It is forbidden to use the SELECT INTO construction inside UNION statements unless on the last SELECT of the union. The parser records whether it has seen INTO or not when parsing a UNION statement. But if the INTO was legally used in an outer query, an error is thrown if UNION is seen in a subquery. Fixed in 5.0 by remembering the nesting level of INTO tokens and mitigate the error unless it collides with the UNION. mysql-test/r/union.result: Bug#32858: Test result mysql-test/t/union.test: Bug#32858: Test case sql/sql_class.cc: Bug#32858: Initializing new member sql/sql_class.h: Bug#32858: Added property nest_level to select_result class. sql/sql_yacc.yy: Bug#32858: The fix.
Diffstat (limited to 'mysql-test/r/union.result')
-rw-r--r--mysql-test/r/union.result42
1 files changed, 42 insertions, 0 deletions
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index 295451867c8..3f99a053df4 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -153,6 +153,48 @@ ERROR 42S22: Unknown column 'a' in 'field list'
1 3
1 3
2 1
+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;
+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;
+SELECT a INTO @v FROM t1 UNION SELECT a FROM t1;
+ERROR HY000: Incorrect usage of UNION and INTO
+SELECT a INTO OUTFILE 'union.out.file7' FROM t1 UNION SELECT a FROM t1;
+ERROR HY000: Incorrect usage of UNION and INTO
+SELECT a INTO DUMPFILE 'union.out.file8' FROM t1 UNION SELECT a FROM t1;
+ERROR HY000: Incorrect usage of UNION and INTO
+DROP TABLE t1;
CREATE TABLE t1 (
`pseudo` char(35) NOT NULL default '',
`pseudo1` char(35) NOT NULL default '',