Commit 9c3a76c8 authored by Alexander Barkov's avatar Alexander Barkov

Merge 5.3->5.5

parents 5d1ec1b9 41b05451
...@@ -1721,6 +1721,21 @@ foo ...@@ -1721,6 +1721,21 @@ foo
deallocate prepare stmt1; deallocate prepare stmt1;
End of 5.1 tests 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, # Bug#57986 ORDER BY clause is not used after a UNION,
# if embedded in a SELECT # if embedded in a SELECT
# #
......
...@@ -1171,6 +1171,25 @@ deallocate prepare stmt1; ...@@ -1171,6 +1171,25 @@ deallocate prepare stmt1;
--echo End of 5.1 tests --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 #
--echo # Bug#57986 ORDER BY clause is not used after a UNION, --echo # Bug#57986 ORDER BY clause is not used after a UNION,
--echo # if embedded in a SELECT --echo # if embedded in a SELECT
......
...@@ -3867,7 +3867,7 @@ void SELECT_LEX::update_used_tables() ...@@ -3867,7 +3867,7 @@ void SELECT_LEX::update_used_tables()
} }
for (ORDER *order= group_list.first; order; order= order->next) for (ORDER *order= group_list.first; order; order= order->next)
(*order->item)->update_used_tables(); (*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) for (ORDER *order= order_list.first; order; order= order->next)
(*order->item)->update_used_tables(); (*order->item)->update_used_tables();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment