summaryrefslogtreecommitdiff
path: root/sql/sql_list.h
diff options
context:
space:
mode:
authorunknown <sanja@montyprogram.com>2012-04-05 23:32:57 +0300
committerunknown <sanja@montyprogram.com>2012-04-05 23:32:57 +0300
commit1a48919036a7746a15ff6bd19cb52c25fc6a57c1 (patch)
tree0f5bd918b9c369c6a8541faccf3f3409775c98a6 /sql/sql_list.h
parentcc2298ebb7e1225d6a293281bc949d746040d547 (diff)
downloadmariadb-git-1a48919036a7746a15ff6bd19cb52c25fc6a57c1.tar.gz
Fix of LP bug#968720.
When a view/derived table is converted from merged to materialized the items from the used_item lists are substituted for items referring to the fields of the result of the materialization. The problem appeared with queries employing natural joins. Since the resolution of a natural join was performed only once the used_item list formed at the second execution of the query lacked the references to the fields that were used only in the equality predicates generated for the natural join.
Diffstat (limited to 'sql/sql_list.h')
-rw-r--r--sql/sql_list.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/sql/sql_list.h b/sql/sql_list.h
index adedd9a3a4d..e71fdc83177 100644
--- a/sql/sql_list.h
+++ b/sql/sql_list.h
@@ -257,6 +257,26 @@ public:
last= &first;
return tmp->info;
}
+
+ /**
+ Cut the list with leaving not more then n elements
+ */
+ inline uint cut(uint n)
+ {
+ list_node *element= first;
+ uint i= 0;
+ for (;
+ i < n && element != &end_of_list;
+ element= element->next, i++);
+ if (element != &end_of_list)
+ {
+ elements= i + 1;
+ last= &element->next;
+ element->next= &end_of_list;
+ }
+ return i + 1;
+ }
+
/*
Remove from this list elements that are contained in the passed list.
We assume that the passed list is a tail of this list (that is, the whole