Commit 1feb6ea6 authored by unknown's avatar unknown

A fix for the bug when MyISAM tmp table has to be created in order

to resolve derived table.

Will make a test case for this quite soon.
parent cf9806fc
...@@ -88,6 +88,7 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t) ...@@ -88,6 +88,7 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t)
if ((derived_result=new select_union(table))) if ((derived_result=new select_union(table)))
{ {
derived_result->tmp_table_param=&tmp_table_param;
unit->offset_limit_cnt= sl->offset_limit; unit->offset_limit_cnt= sl->offset_limit;
unit->select_limit_cnt= sl->select_limit+sl->offset_limit; unit->select_limit_cnt= sl->select_limit+sl->offset_limit;
if (unit->select_limit_cnt < sl->select_limit) if (unit->select_limit_cnt < sl->select_limit)
...@@ -118,7 +119,7 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t) ...@@ -118,7 +119,7 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t)
table->tmp_table=TMP_TABLE; table->tmp_table=TMP_TABLE;
if (!lex->describe) if (!lex->describe)
sl->exclude(); sl->exclude();
t->db=""; t->db=(char *)"";
t->derived=(SELECT_LEX *)0; // just in case ... t->derived=(SELECT_LEX *)0; // just in case ...
} }
} }
......
...@@ -80,6 +80,7 @@ bool select_union::send_data(List<Item> &values) ...@@ -80,6 +80,7 @@ bool select_union::send_data(List<Item> &values)
{ {
if (create_myisam_from_heap(table, tmp_table_param, info.last_errno, 0)) if (create_myisam_from_heap(table, tmp_table_param, info.last_errno, 0))
return 1; return 1;
thd->net.report_error=0; // donno why does it work, but it does ...
} }
return 0; return 0;
} }
......
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