summaryrefslogtreecommitdiff
path: root/mysql-test/t/union.test
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2012-06-08 22:15:49 -0700
committerIgor Babaev <igor@askmonty.org>2012-06-08 22:15:49 -0700
commit10f42e2c33dff630559299e4151e10a84ce39fd8 (patch)
treec201a24f62b2e2dbfa1114d9d1eee76477d61d8a /mysql-test/t/union.test
parentca5473f1db6dc63baffc736737e54bdffd6449a6 (diff)
downloadmariadb-git-10f42e2c33dff630559299e4151e10a84ce39fd8.tar.gz
Fixed LP bug #1010729.
The bug prevented acceptance of UNION queries whose non-first select clauses contained join expressions with degenerated single-table nests as valid queries. The bug was introduced into mysql-5.5 code line by the patch for bug 33204.
Diffstat (limited to 'mysql-test/t/union.test')
-rw-r--r--mysql-test/t/union.test20
1 files changed, 20 insertions, 0 deletions
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index 9c03f93028c..94860ceec2d 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -1237,3 +1237,23 @@ SELECT(SELECT 0 AS a FROM dual UNION SELECT 1 AS a FROM dual ORDER BY a DESC LIM
SELECT(SELECT 1 AS a ORDER BY a) AS dev;
SELECT(SELECT 1 AS a LIMIT 1) AS dev;
SELECT(SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev;
+
+--echo #
+--echo # LP bug#1010729: Unexpected syntax error from UNION
+--echo # (bug #54382) with single-table join nest
+--echo #
+CREATE TABLE t1 (a int);
+CREATE TABLE t2 (b int);
+CREATE TABLE t3 (c int);
+SELECT a FROM t1 UNION SELECT b FROM t2 JOIN (t3) ON ( t2.b = t3.c );
+
+DROP TABLE t1, t2, t3;
+
+CREATE TABLE t1 (pk int NOT NULL);
+CREATE TABLE t2 (pk int NOT NULL, fk int NOT NULL);
+SELECT t1.pk FROM t1 LEFT JOIN (t2) ON (t1.pk = t2.fk)
+UNION
+SELECT t1.pk FROM t1 LEFT JOIN (t2) ON (t1.pk = t2.fk);
+
+DROP TABLE t1,t2;
+