summaryrefslogtreecommitdiff
path: root/mysql-test/t/parser.test
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2015-06-24 14:58:17 +0400
committerSergey Vojtovich <svoj@mariadb.org>2015-06-29 11:04:55 +0400
commit0865e3deab7be2bd49128906fe4f495460ebcbca (patch)
treeecf723a1e31cb76e86722faa3b7e401086f72373 /mysql-test/t/parser.test
parentad9b3263d3c5e4784008cc748ae1af8494da3f05 (diff)
downloadmariadb-git-0865e3deab7be2bd49128906fe4f495460ebcbca.tar.gz
MDEV-7792 - SQL Parsing Error - UNION AND ORDER BY WITH JOIN
ORDER BY against union may confuse name resolution context, causing valid SQL statements to fail. The purpose of context change was presumably intended for the duration of gathering field list for ORDER BY. However it isn't actually required (name resolution context is never accessed by the latter). See also alternative solution (in MySQL 5.7): 92145b95.
Diffstat (limited to 'mysql-test/t/parser.test')
-rw-r--r--mysql-test/t/parser.test7
1 files changed, 7 insertions, 0 deletions
diff --git a/mysql-test/t/parser.test b/mysql-test/t/parser.test
index f59a5d01cf5..31c6ab92ba8 100644
--- a/mysql-test/t/parser.test
+++ b/mysql-test/t/parser.test
@@ -758,3 +758,10 @@ CREATE TABLE t1 (s VARCHAR(100));
CREATE TRIGGER trigger1 BEFORE INSERT ON t1 FOR EACH ROW
SET default_storage_engine = NEW.INNODB;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-7792 - SQL Parsing Error - UNION AND ORDER BY WITH JOIN
+--echo #
+CREATE TABLE t1(a INT);
+SELECT * FROM t1 JOIN ((SELECT 1 AS b) UNION ALL (SELECT 2 AS b) ORDER BY b DESC) s1 WHERE a=1;
+DROP TABLE t1;