From c47c56452680e1bbdaa9d8ed4203470cf7f02c56 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 31 May 2003 18:31:57 +0300 Subject: Fix for the optimiser problem caused by the fact that with derived tables one (or more tables) is opened / closed twice. --- sql/sql_derived.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sql/sql_derived.cc') diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index 7f555f37d40..66b8048996f 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -219,6 +219,8 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, /* Add new temporary table to list of open derived tables */ table->next= thd->derived_tables; thd->derived_tables= table; + thd->query_id++; + query_id++; } exit: -- cgit v1.2.1 From 4ac20ad4a925fe9efa4f0937ddeb026cf112857f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 12 Jun 2003 16:52:36 +0300 Subject: Derived tables bug fix ....... sql/ha_myisam.cc: DISABLE KEYS warnings sql/sql_table.cc: DISABLE KEYS warnings --- sql/sql_derived.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'sql/sql_derived.cc') diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index b2a055b3ee5..1cb0ea2ea5f 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -122,6 +122,16 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, res= -1; goto exit; } + + /* + This is done in order to redo all field optimisations when any of the + involved tables is used in the outer query + */ + if (tables) + { + for (TABLE_LIST *cursor= tables; cursor; cursor= cursor->next) + cursor->table->clear_query_id= 1; + } item_list= select_cursor->item_list; select_cursor->with_wild= 0; @@ -223,8 +233,6 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, /* Add new temporary table to list of open derived tables */ table->next= thd->derived_tables; thd->derived_tables= table; - thd->query_id++; - query_id++; } exit: -- cgit v1.2.1