Re: [Maria-developers] [Commits] Rev 3488: Fix of LP bug#968720. in file:///home/bell/maria/bzr/work-maria-5.3-lpb968720/

Sanja, Please correct the comment (see my variant below) and fix the problem in cut() I discovered. Sorry, I basically don't understand your code. Contact me on IRC please. Regards, Igor. On 04/04/2012 04:01 AM, sanja@montyprogram.com wrote: 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. the temporary table of materialized join. The problem was that natural join matching made only once and on second prepare phase (first is prepare opf PREPARE statement, second is prepare phase of executing the statement) the list lack fields of natural join because it is not made second time.
+ /* + Save the lists made during natural join matching (because + the matching done only once but we need the list in case + of prepared statements). + */ ^ remove this comment altogether. + table_ref_1->save_used_items= table_ref_1->used_items; + table_ref_2->save_used_items= table_ref_2->used_items; You save here the head of list only. Why? + ... + /** + Cut the list with leaving not more then n elements ^to leave + */ + inline uint cut(uint n) + { + list_node *element= first; + uint i= 0; + for (; + i < n && element != &end_of_list; + element= element->next); + if (element != &end_of_list) + { + elements= i + 1; + last= &element->next; + element->next= &end_of_list; + } + return i + 1; + } ^^^ i is initialized to 0. i is never changed. in this context the comparison i<n does not make any sense. + /* + Following is a bit hack but pointer length is equal everywhere + and we need revert pointers after prepared statement execution. + */ ^We need to restore the pointers after the execution of the prepared statement + thd->change_item_tree((Item **)&ref->ref, (Item*)materialized_items + idx);
participants (1)
-
Igor Babaev