summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mnogosearch.org>2013-11-14 16:26:37 +0400
committerAlexander Barkov <bar@mnogosearch.org>2013-11-14 16:26:37 +0400
commit9c3a76c879582ae94af962747a6e67a1fc5a2189 (patch)
treec5f7aa9c5b65db182c334ad44d3c862fa4c5430e
parent5d1ec1b95147ead6e1f8a6690b7deee690257abf (diff)
parent41b0545194a75d96b6a0b7bcf7f0d21923478623 (diff)
downloadmariadb-git-9c3a76c879582ae94af962747a6e67a1fc5a2189.tar.gz
Merge 5.3->5.5
-rw-r--r--mysql-test/r/union.result15
-rw-r--r--mysql-test/t/union.test19
-rw-r--r--sql/sql_lex.cc2
3 files changed, 35 insertions, 1 deletions
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index 75255d558c4..d1be5e233df 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -1721,6 +1721,21 @@ foo
deallocate prepare stmt1;
End of 5.1 tests
#
+# mdev-5091: Asseirtion failure for UNION with ORDER BY
+# in one of selects
+#
+CREATE TABLE t1 (i int, c char(1)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (6,'b');
+CREATE VIEW v1 AS SELECT * FROM t1;
+( SELECT i FROM v1 GROUP BY i ORDER BY CONCAT( c, c ) LIMIT 1 )
+UNION
+( SELECT i FROM t1 );
+i
+6
+DROP VIEW v1;
+DROP TABLE t1;
+End of 5.3 tests
+#
# Bug#57986 ORDER BY clause is not used after a UNION,
# if embedded in a SELECT
#
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index 94860ceec2d..faa35de3ec1 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -1172,6 +1172,25 @@ deallocate prepare stmt1;
--echo End of 5.1 tests
--echo #
+--echo # mdev-5091: Asseirtion failure for UNION with ORDER BY
+--echo # in one of selects
+--echo #
+
+ CREATE TABLE t1 (i int, c char(1)) ENGINE=MyISAM;
+ INSERT INTO t1 VALUES (6,'b');
+
+ CREATE VIEW v1 AS SELECT * FROM t1;
+
+ ( SELECT i FROM v1 GROUP BY i ORDER BY CONCAT( c, c ) LIMIT 1 )
+ UNION
+ ( SELECT i FROM t1 );
+
+ DROP VIEW v1;
+ DROP TABLE t1;
+
+ --echo End of 5.3 tests
+
+--echo #
--echo # Bug#57986 ORDER BY clause is not used after a UNION,
--echo # if embedded in a SELECT
--echo #
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 55381da1ccd..5fa8672791b 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -3867,7 +3867,7 @@ void SELECT_LEX::update_used_tables()
}
for (ORDER *order= group_list.first; order; order= order->next)
(*order->item)->update_used_tables();
- if (!master_unit()->is_union())
+ if (master_unit()->global_parameters != this)
{
for (ORDER *order= order_list.first; order; order= order->next)
(*order->item)->update_used_tables();