summaryrefslogtreecommitdiff
path: root/sql/sql_select.h
diff options
context:
space:
mode:
authorAlexey Kopytov <Alexey.Kopytov@sun.com>2010-02-09 12:59:38 +0500
committerAlexey Kopytov <Alexey.Kopytov@sun.com>2010-02-09 12:59:38 +0500
commit0888e40fa316b040cb43f6fad112a0cdcd443155 (patch)
tree18b0423763f9cac0e0b38ba5a2175afe5f429844 /sql/sql_select.h
parent7e0d0dd04037a626c0d984553473a1fed4b9fb56 (diff)
parent6124451d9534b1a03e58724411c492d9de980cb4 (diff)
downloadmariadb-git-0888e40fa316b040cb43f6fad112a0cdcd443155.tar.gz
Manual merge of mysql-5.1-bugteam into mysql-trunk-merge.
Conflicts: Text conflict in .bzr-mysql/default.conf Text conflict in mysql-test/suite/rpl/r/rpl_slow_query_log.result Text conflict in mysql-test/suite/rpl/t/rpl_slow_query_log.test Conflict adding files to server-tools. Created directory. Conflict because server-tools is not versioned, but has versioned children. Versioned directory. Conflict adding files to server-tools/instance-manager. Created directory. Conflict because server-tools/instance-manager is not versioned, but has versioned children. Versioned directory. Contents conflict in server-tools/instance-manager/options.cc Text conflict in sql/mysqld.cc
Diffstat (limited to 'sql/sql_select.h')
-rw-r--r--sql/sql_select.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/sql/sql_select.h b/sql/sql_select.h
index a84fa65a548..79758f08a69 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -361,7 +361,25 @@ public:
*/
bool no_const_tables;
- JOIN *tmp_join; ///< copy of this JOIN to be used with temporary tables
+ /**
+ Copy of this JOIN to be used with temporary tables.
+
+ tmp_join is used when the JOIN needs to be "reusable" (e.g. in a subquery
+ that gets re-executed several times) and we know will use temporary tables
+ for materialization. The materialization to a temporary table overwrites the
+ JOIN structure to point to the temporary table after the materialization is
+ done. This is where tmp_join is used : it's a copy of the JOIN before the
+ materialization and is used in restoring before re-execution by overwriting
+ the current JOIN structure with the saved copy.
+ Because of this we should pay extra care of not freeing up helper structures
+ that are referenced by the original contents of the JOIN. We can check for
+ this by making sure the "current" join is not the temporary copy, e.g.
+ !tmp_join || tmp_join != join
+
+ We should free these sub-structures at JOIN::destroy() if the "current" join
+ has a copy is not that copy.
+ */
+ JOIN *tmp_join;
ROLLUP rollup; ///< Used with rollup
bool select_distinct; ///< Set if SELECT DISTINCT