1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

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.
This commit is contained in:
Georgi Kodinov
2010-04-15 17:04:24 +03:00
parent 5b54e86ec1
commit a8ae3cd6e9
3 changed files with 44 additions and 1 deletions

View File

@ -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