summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorSergey Glukhov <sergey.glukhov@oracle.com>2010-11-08 13:51:39 +0300
committerSergey Glukhov <sergey.glukhov@oracle.com>2010-11-08 13:51:39 +0300
commit50a3c55ee7e378b36bca5940e382fb18674dbd9b (patch)
tree4e297b3f9938c5fc429efccf740555cb6966054f /sql/sql_select.cc
parent0a29baba4bae36b947aba9001956f3c800f4205f (diff)
downloadmariadb-git-50a3c55ee7e378b36bca5940e382fb18674dbd9b.tar.gz
Bug#52711 Segfault when doing EXPLAIN SELECT with union...order by (select... where...)
backport from 5.1 mysql-test/r/subselect.result: backport from 5.1 mysql-test/t/subselect.test: backport from 5.1 sql/sql_select.cc: backport from 5.1
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 53a6b699022..929ef3c8949 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -501,7 +501,7 @@ JOIN::prepare(Item ***rref_pointer_array,
thd->lex->allow_sum_func= save_allow_sum_func;
}
- if (!thd->lex->view_prepare_mode)
+ if (!thd->lex->view_prepare_mode && !(select_options & SELECT_DESCRIBE))
{
Item_subselect *subselect;
/* Is it subselect? */
@@ -6861,7 +6861,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