summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/union.test13
1 files changed, 13 insertions, 0 deletions
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index 2bdf8420d6d..cc93fbd715a 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -900,4 +900,17 @@ drop table t1, t2;
#
select _utf8'12' union select _latin1'12345';
+#
+# Bug #26661: UNION with ORDER BY undefined column in FROM list
+#
+
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (3),(1),(2),(4),(1);
+
+SELECT a FROM (SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY a) AS test;
+--error 1054
+SELECT a FROM (SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY c) AS test;
+
+DROP TABLE t1;
+
--echo End of 5.0 tests