diff options
author | Georgi Kodinov <joro@sun.com> | 2010-04-15 17:04:24 +0300 |
---|---|---|
committer | Georgi Kodinov <joro@sun.com> | 2010-04-15 17:04:24 +0300 |
commit | 93013ae6307fad0525c5317b798e3f394de95cbd (patch) | |
tree | 3802fe4c126313ee2f05b6b546702a0948f283f6 /sql | |
parent | d066fe78e759dae2c28f149a4c229695293050f6 (diff) | |
download | mariadb-git-93013ae6307fad0525c5317b798e3f394de95cbd.tar.gz |
Bug #52711: Segfault when doing EXPLAIN SELECT with
union...order by (select... where...)
The problem is mysql is trying to materialize and
cache the scalar sub-queries at JOIN::optimize
even for EXPLAIN where the number of columns is
totally different from what's expected.
Fixed by not executing the scalar subqueries
for EXPLAIN.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_select.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index a426f4b68a1..6886db87ddf 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -7210,7 +7210,8 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond, *simple_order=0; // Must do a temp table to sort else if (!(order_tables & not_const_tables)) { - if (order->item[0]->with_subselect) + if (order->item[0]->with_subselect && + !(join->select_lex->options & SELECT_DESCRIBE)) order->item[0]->val_str(&order->item[0]->str_value); DBUG_PRINT("info",("removing: %s", order->item[0]->full_name())); continue; // skip const item |