mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Fixed bug mdev-5091.
The function SELECT_LEX::update_used_tables should process all ORDER BY lists in any subselect of a union.
This commit is contained in:
@ -1724,3 +1724,18 @@ foo
|
||||
1
|
||||
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
|
||||
|
@ -1210,3 +1210,22 @@ execute stmt1;
|
||||
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
|
||||
|
||||
|
@ -3534,7 +3534,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();
|
||||
|
Reference in New Issue
Block a user