summaryrefslogtreecommitdiff
path: root/sql/sql_union.cc
diff options
context:
space:
mode:
authorigor@olga.mysql.com <>2007-05-14 16:41:09 -0700
committerigor@olga.mysql.com <>2007-05-14 16:41:09 -0700
commitd71043b8892ffa6ac1fc66b1ab7e082bcb234bab (patch)
treec69d06d257c43de7983d59c91eb31625c3043087 /sql/sql_union.cc
parent681ef616ed92a6657ad4b5e6879edba5e8602250 (diff)
downloadmariadb-git-d71043b8892ffa6ac1fc66b1ab7e082bcb234bab.tar.gz
Fixed bug #27937: crash for the the second execution of a prepared
statement from a UNION query with ORDER BY an expression containing RAND(). The crash happened because the global order by list in the union query was not re-initialized for execution. (Local order by lists were re-initialized though).
Diffstat (limited to 'sql/sql_union.cc')
-rw-r--r--sql/sql_union.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index f3f814831f5..615d060a5a8 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -135,6 +135,11 @@ st_select_lex_unit::init_prepare_fake_select_lex(THD *thd)
fake_select_lex->table_list.link_in_list((byte *)&result_table_list,
(byte **)
&result_table_list.next);
+ for (ORDER *order= (ORDER *) global_parameters->order_list.first;
+ order;
+ order= order->next)
+ order->item= &order->item_ptr;
+
return options_tmp;
}