From 1a48919036a7746a15ff6bd19cb52c25fc6a57c1 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 5 Apr 2012 23:32:57 +0300 Subject: 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. --- sql/sql_list.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'sql/sql_list.h') 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 -- cgit v1.2.1