summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2017-06-07 22:54:57 -0700
committerIgor Babaev <igor@askmonty.org>2017-06-07 22:54:57 -0700
commitb850fc66ca72ed9b63cb8b899b64f8c555a525c7 (patch)
tree157ec5f7e859fdf4e5b24fe7deb5a3db01c436a2 /sql
parent151f4e9b4adea020fbe19b640016845dfa65d820 (diff)
downloadmariadb-git-b850fc66ca72ed9b63cb8b899b64f8c555a525c7.tar.gz
Fixed the bug mdev-12855.
This is actually a legacy bug: SQL_SELECT::test_quick_select() was called with SQL_SELECT::head not set. It looks like that this problem can be reproduced only on queries with ORDER BY that use IN predicates converted to semi-joins.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_select.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index f2be17f71d6..720c0a22681 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -2759,8 +2759,11 @@ JOIN::exec()
if (sort_table_cond)
{
if (!curr_table->select)
+ {
if (!(curr_table->select= new SQL_SELECT))
DBUG_VOID_RETURN;
+ curr_table->select->head= curr_table->table;
+ }
if (!curr_table->select->cond)
curr_table->select->cond= sort_table_cond;
else
@@ -2846,7 +2849,7 @@ JOIN::exec()
curr_join->select_limit,
(select_options & OPTION_FOUND_ROWS ?
HA_POS_ERROR : unit->select_limit_cnt),
- curr_join->group_list ? TRUE : FALSE))
+ curr_join->group_list ? FALSE : TRUE))
DBUG_VOID_RETURN;
sortorder= curr_join->sortorder;
if (curr_join->const_tables != curr_join->table_count &&