summaryrefslogtreecommitdiff
path: root/mysql-test/r/union.result
diff options
context:
space:
mode:
authorSergey Glukhov <Sergey.Glukhov@sun.com>2009-05-15 12:03:34 +0500
committerSergey Glukhov <Sergey.Glukhov@sun.com>2009-05-15 12:03:34 +0500
commitfc57b4cfb569635edc1613154d9b7ed14efaf840 (patch)
treec83f6124be299756d10d2cca2430ee5dc5cd04da /mysql-test/r/union.result
parentccc0ffb419b688a35ab6da98a4166d5739e255d6 (diff)
downloadmariadb-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/r/union.result')
-rw-r--r--mysql-test/r/union.result13
1 files changed, 13 insertions, 0 deletions
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index a5f49eef8d1..e806ed49c34 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -1518,4 +1518,17 @@ SHOW FIELDS FROM t2;
Field Type Null Key Default Extra
d double(9,6) YES NULL
DROP TABLE t1, t2;
+CREATE TABLE t1(a INT);
+EXPLAIN EXTENDED
+SELECT a FROM t1
+UNION
+SELECT a FROM t1
+ORDER BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+2 UNION t1 system NULL NULL NULL NULL 0 const row not found
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL Using filesort
+Warnings:
+Note 1003 select '0' AS `a` from `test`.`t1` union select '0' AS `a` from `test`.`t1` order by `a`
+DROP TABLE t1;
End of 5.0 tests