diff options
author | Sergey Glukhov <Sergey.Glukhov@sun.com> | 2009-05-15 12:03:34 +0500 |
---|---|---|
committer | Sergey Glukhov <Sergey.Glukhov@sun.com> | 2009-05-15 12:03:34 +0500 |
commit | fc57b4cfb569635edc1613154d9b7ed14efaf840 (patch) | |
tree | c83f6124be299756d10d2cca2430ee5dc5cd04da /mysql-test/t/union.test | |
parent | ccc0ffb419b688a35ab6da98a4166d5739e255d6 (diff) | |
download | mariadb-git-fc57b4cfb569635edc1613154d9b7ed14efaf840.tar.gz |
Bug#43612 crash with explain extended, union, order by
In UNION if we use last SELECT without braces and this
SELECT have ORDER BY clause, such clause belongs to
global UNION. It is parsed like last SELECT
part and used further as 'unit->global_parameters->order_list' value.
During DESCRIBE EXTENDED we call select_lex->print_order() for
last SELECT where order fields refer to tmp table
which already freed. It leads to crash.
The fix is clean up global_parameters->order_list
instead of fake_select_lex->order_list.
mysql-test/r/union.result:
test result
mysql-test/t/union.test:
test case
sql/sql_union.cc:
In UNION if we use last SELECT without braces and this
SELECT have ORDER BY clause, such clause belongs to
global UNION. It is parsed like last SELECT
part and used further as 'unit->global_parameters->order_list' value.
During DESCRIBE EXTENDED we call select_lex->print_order() for
last SELECT where order fields refer to tmp table
which already freed. It leads to crash.
The fix is clean up global_parameters->order_list
instead of fake_select_lex->order_list.
Diffstat (limited to 'mysql-test/t/union.test')
-rw-r--r-- | mysql-test/t/union.test | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index 1dbbdae24b7..0c8e025e54e 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -1038,4 +1038,16 @@ CREATE TABLE t2 AS SELECT d FROM t1 UNION SELECT d FROM t1; SHOW FIELDS FROM t2; DROP TABLE t1, t2; +# +# Bug#43612 crash with explain extended, union, order by +# +CREATE TABLE t1(a INT); +EXPLAIN EXTENDED +SELECT a FROM t1 +UNION +SELECT a FROM t1 +ORDER BY a; +DROP TABLE t1; + + --echo End of 5.0 tests |