summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2012-12-14 12:02:08 -0800
committerIgor Babaev <igor@askmonty.org>2012-12-14 12:02:08 -0800
commite44253a125c3baf7ea448edce77389810425df2a (patch)
tree3ef8c13625c15454ea6c703de048b845cb917923 /sql
parenta06224bd1594ea1da650f748a8956922eafd2363 (diff)
parentb8b875cb796743240bed71857eae73d37f03c28f (diff)
downloadmariadb-git-e44253a125c3baf7ea448edce77389810425df2a.tar.gz
Merge 5.5 -> mwl248
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_select.cc13
-rw-r--r--sql/sql_select.h3
2 files changed, 16 insertions, 0 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 85908623324..3550155606e 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -2075,6 +2075,7 @@ JOIN::reinit()
ULL(0));
first_record= 0;
+ cleaned= false;
if (exec_tmp_table1)
{
@@ -10626,6 +10627,7 @@ void JOIN::cleanup(bool full)
{
tab->cleanup();
}
+ cleaned= true;
}
else
{
@@ -22418,6 +22420,17 @@ void st_select_lex::print(THD *thd, String *str, enum_query_type query_type)
str->append(STRING_WITH_LEN("select "));
+ if (join && join->cleaned)
+ {
+ /*
+ JOIN already cleaned up so it is dangerous to print items
+ because temporary tables they pointed on could be freed.
+ */
+ str->append('#');
+ str->append(select_number);
+ return;
+ }
+
/* First add options */
if (options & SELECT_STRAIGHT_JOIN)
str->append(STRING_WITH_LEN("straight_join "));
diff --git a/sql/sql_select.h b/sql/sql_select.h
index e4687b4f00c..bac29b96c5a 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -1141,6 +1141,8 @@ public:
bool skip_sort_order;
bool need_tmp, hidden_group_fields;
+ /* TRUE if there was full cleunap of the JOIN */
+ bool cleaned;
DYNAMIC_ARRAY keyuse;
Item::cond_result cond_value, having_value;
List<Item> all_fields; ///< to store all fields that used in query
@@ -1268,6 +1270,7 @@ public:
zero_result_cause= 0;
optimized= 0;
initialized= 0;
+ cleaned= 0;
cond_equal= 0;
having_equal= 0;
exec_const_cond= 0;