summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorTor Didriksen <tor.didriksen@oracle.com>2012-09-12 08:59:44 +0200
committerTor Didriksen <tor.didriksen@oracle.com>2012-09-12 08:59:44 +0200
commit26269e0d4b2575af27661658a9e876cb388fc153 (patch)
tree606592d485c767396d825f4e7380cbb83f6e23f7 /sql
parentbcf36b227a1a8e788058c150d3293eaf523ac3eb (diff)
parent06e4a9696b2cc314ac4d2fb09f4151060a3ac434 (diff)
downloadmariadb-git-26269e0d4b2575af27661658a9e876cb388fc153.tar.gz
merge 5.1 => 5.5
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_list.h10
-rw-r--r--sql/sql_select.cc15
2 files changed, 20 insertions, 5 deletions
diff --git a/sql/sql_list.h b/sql/sql_list.h
index c68ecc07e11..bdbe381eb8e 100644
--- a/sql/sql_list.h
+++ b/sql/sql_list.h
@@ -1,6 +1,6 @@
#ifndef INCLUDES_MYSQL_SQL_LIST_H
#define INCLUDES_MYSQL_SQL_LIST_H
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -174,6 +174,14 @@ protected:
public:
uint elements;
+ bool operator==(const base_list &rhs) const
+ {
+ return
+ elements == rhs.elements &&
+ first == rhs.first &&
+ last == rhs.last;
+ }
+
inline void empty() { elements=0; first= &end_of_list; last=&first;}
inline base_list() { empty(); }
/**
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 808af9d69ab..fd6d0e44597 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1719,6 +1719,8 @@ JOIN::optimize()
*/
void JOIN::restore_tmp()
{
+ DBUG_PRINT("info", ("restore_tmp this %p tmp_join %p", this, tmp_join));
+ DBUG_ASSERT(tmp_join != this);
memcpy(tmp_join, this, (size_t) sizeof(JOIN));
}
@@ -7202,13 +7204,18 @@ void JOIN::cleanup(bool full)
{
if (tmp_join)
tmp_table_param.copy_field= 0;
- group_fields.delete_elements();
+
/*
- Ensure that the above delete_elements() would not be called
+ Ensure that the following delete_elements() would not be called
twice for the same list.
*/
- if (tmp_join && tmp_join != this)
- tmp_join->group_fields= group_fields;
+ if (tmp_join && tmp_join != this &&
+ tmp_join->group_fields == this->group_fields)
+ tmp_join->group_fields.empty();
+
+ // Run Cached_item DTORs!
+ group_fields.delete_elements();
+
/*
We can't call delete_elements() on copy_funcs as this will cause
problems in free_elements() as some of the elements are then deleted.