A fix for DELETE with ORDER BY and LIMIT.

How come we do not have a test case for this ??
parent 5ca7b274
...@@ -126,12 +126,15 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order, ...@@ -126,12 +126,15 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
table->io_cache = (IO_CACHE *) my_malloc(sizeof(IO_CACHE), table->io_cache = (IO_CACHE *) my_malloc(sizeof(IO_CACHE),
MYF(MY_FAE | MY_ZEROFILL)); MYF(MY_FAE | MY_ZEROFILL));
if (setup_order(thd, 0, &tables, fields, all_fields, order) || if (setup_ref_array(thd, &thd->lex.select_lex.ref_pointer_array,
!(sortorder=make_unireg_sortorder(order, &length)) || all_fields.elements)||
(table->found_records = filesort(thd, table, sortorder, length, setup_order(thd, thd->lex.select_lex.ref_pointer_array, &tables,
(SQL_SELECT *) 0, HA_POS_ERROR, fields, all_fields, order) ||
&examined_rows)) !(sortorder=make_unireg_sortorder(order, &length)) ||
== HA_POS_ERROR) (table->found_records = filesort(thd, table, sortorder, length,
(SQL_SELECT *) 0, HA_POS_ERROR,
&examined_rows))
== HA_POS_ERROR)
{ {
delete select; delete select;
free_underlaid_joins(thd, &thd->lex.select_lex); free_underlaid_joins(thd, &thd->lex.select_lex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment