summaryrefslogtreecommitdiff
path: root/mysql-test/t/union.test
diff options
context:
space:
mode:
authorunknown <igor@olga.mysql.com>2007-03-09 01:45:32 -0800
committerunknown <igor@olga.mysql.com>2007-03-09 01:45:32 -0800
commit729bcaf430d3c41606611b87b976645e1e744b04 (patch)
treec14c007735ea1a3f5b637d3dec24b746c086a1c1 /mysql-test/t/union.test
parente4cdb5801325acf72dbbe197c3c2eb2f7c7244b7 (diff)
downloadmariadb-git-729bcaf430d3c41606611b87b976645e1e744b04.tar.gz
Fixed bug #26661: crash when order by clause in a union
construct references invalid name. Derived tables currently cannot use outer references. Thus there is no outer context for them. The 4.1 code takes this fact into account while the Item_field::fix_outer_field code of 5.0 lost the check that blocks any attempts to resolve names in outer context for derived tables. mysql-test/r/union.result: Added a test case for bug #26661. mysql-test/t/union.test: Added a test case for bug #26661. sql/item.cc: Fixed bug #26661. Derived tables currently cannot use outer references. Thus there is no outer context for them. The 4.1 code takes this fact into account while the Item_field::fix_outer_field code of 5.0 lost the check that blocks any attempts to resolve names in outer context for derived tables.
Diffstat (limited to 'mysql-test/t/union.test')
-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 bf5c5e066f0..29a9ee36481 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -855,4 +855,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